Skip to content

Use Settings in your Rails initializers

stevenhaddox edited this page Aug 26, 2011 · 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 contents to the top of your config/application.rb, like so:

#/config/application.rb
require 'settingslogic'
class Settings < Settingslogic
  source "config/application.yml"
  namespace Rails.env
  load!
end

module <AppName>
...

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.

Clone this wiki locally