-
Notifications
You must be signed in to change notification settings - Fork 186
Use Settings in your Rails initializers
David Collom edited this page Nov 6, 2013
·
3 revisions
If you want to be able to use your settingslogic Setting class within your Rails initializers it's fairly easy. Just move your app/models/setting.rb model file to live under your lib folder. This will give you access to all Settings within your initializers as well as your application code.
Hope this helps someone else as I really wanted to enable / disable things (like Mailcatcher configs) in my initializers but wanted those flags to exist on a per-server basis.
This is only true after including the following within config/application.rb
config.autoload_paths += %W(
#{config.root}/lib
)
I found this after a long day of head scratching from one rails app to another!