Skip to content

Instantly share code, notes, and snippets.

@floehopper
Created July 31, 2017 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floehopper/bd27ed6657c4ccef17521b6c508e3e34 to your computer and use it in GitHub Desktop.
Save floehopper/bd27ed6657c4ccef17521b6c508e3e34 to your computer and use it in GitHub Desktop.
Rails app configuration
# config/application.rb
module Foo
class Railtie < Rails::Railtie
config.foo = ActiveSupport::OrderedOptions.new
end
def self.config
Railtie.config.foo
end
class Application < Rails::Application
# Rails configuration
# e.g. config.time_zone = 'Central Time (US & Canada)'
end
end
# config/initializers/bar.rb
Foo.config.bar = 'wem'
# some other file in the application
p Foo.config.bar # => 'wem'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment