YAML Configuration File
Blog ยป YAML Configuration File
Posted on 1247134944|%A: %d %B, %Y|agohover
In Ruby on Rails, you can create application specific configuration files. Put in "config/initializers/myapp.rb"
MYAPP_CONFIG=YAML::load( ERB.new( IO.read( "#{RAILS_ROOT}/config/myapp.yml" ) ).result )[RAILS_ENV].symbolize_keys
In "config/myapp.ytml"
development:
mode: development
test:
mode: test
production:
mode: production
You can access MYAPP_CONFIG throughout the application:
MYAPP_CONFIG[:mode] #=> 'development'
If you like this page, please spread the word:
As well as commenting here, you can tweet or email to me
Add a new comment







