Skip to content

Instantly share code, notes, and snippets.

@basti
Created June 12, 2013 10:42
Show Gist options
  • Save basti/5764328 to your computer and use it in GitHub Desktop.
Save basti/5764328 to your computer and use it in GitHub Desktop.
Simple custom configuration within Rails App using initializer and YAML file.
# or in any other file
MY_CONFIG[:foo]
# config/initializers/my_config.rb
config_file = File.expand_path('../../my_config.yml', __FILE__)
MY_CONFIG = File.exists?(config_file) ? YAML.load(File.read(config_file)) : {}
MY_CONFIG.symbolize_keys!
# config/my_config.rb
---
:foo: boo
Based on http://railscasts.com/episodes/85-yaml-configuration-revised
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment