Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uninitialized constant Project::Application::Settings (NameError) #32

Closed
ingithub opened this issue Mar 24, 2013 · 1 comment
Closed

Comments

@ingithub
Copy link

Hi, I have problem with the new version 2.0.

How can I initialize constant Settings?
I can't load settings in application.rb

config.after_initialize do
      I18n.default_locale = Settings.i18n_default_locale
end

Thanks

@ledermann
Copy link
Owner

In 2.0, there are no global settings anymore. Every setting has to be linked to an existing ActiveRecord instance. Example:

class Account < ActiveRecord::Base
  has_settings :i18n, :something_other, :foo, :bar
end

account = Account.find(42)
account.settings(:i18n).locale = 'de'
account.save!
...
account.settings(:i18n).locale
# => 'de'

If you still need global settings, you can use your own YAML files or a gem like Configatron. Of course you can stil use branch 1.x of my gem, but this is not maintained anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants