Skip to content

Instantly share code, notes, and snippets.

@chumpy
Created October 31, 2012 18:52
Show Gist options
  • Select an option

  • Save chumpy/3989073 to your computer and use it in GitHub Desktop.

Select an option

Save chumpy/3989073 to your computer and use it in GitHub Desktop.
Rails app contants in YAML file (adapted from http://goo.gl/9EuAh)
# this goes in config/initializers
APP_CONFIG = YAML.load(File.read(File.expand_path('../../app_constants.yml', __FILE__)))[Rails.env]
# this goes in config/
# these values can be accessed via my_const1 = APP_CONFIG['my_const1']
defaults: &defaults
my_const1: some value
my_const2: some other value
development:
<<: *defaults
test:
<<: *defaults
production:
<<: *defaults
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment