Skip to content

Instantly share code, notes, and snippets.

@wrburgess
Created September 19, 2012 23:49
Show Gist options
  • Save wrburgess/3753085 to your computer and use it in GitHub Desktop.
Save wrburgess/3753085 to your computer and use it in GitHub Desktop.
Setting up SettingsLogic on Rails 3

#Setting up SettingsLogic on Rails 3

Add the Gem

In the Gemfile

gem 'settingslogic'

Run bundler

bundler install

Create Initializer File

Create the initializer file as config/initializers/app_settings.rb

class Settings < Settingslogic
  source "#{Rails.root}/config/settings.yml"
  namespace Rails.env
end

Note: you need to name file app_settings.rb so that the file loads alphabetically in rails first amongst the initializers

Create Settings File

Create the settings file as config/settings.yml

    defaults: &defaults
      app:
        name: "App Name"
        server: "Default"

    test:
      <<: *defaults
      app:
        server: "Test"

    development:
      <<: *defaults
      app:
        server: "Development"

    production:
      <<: *defaults
      app:
        server: "Production"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment