The example in this article had production and dev, but for some reason omits test
]]>1 2 3 4 5 | # app-specific config require 'ostruct' require 'yaml' config = OpenStruct.new(YAML.load_file("#{RAILS_ROOT}/config/chef.yml")) ::AppConfig = OpenStruct.new(config.send(RAILS_ENV)) |
Test:
1 2 3 | def test_test_base assert_not_nil AppConfig.test_base end |
Passes. When I change it to assert_nil it fails, and I see that it was actually set.
]]>Problem with:
1 | env_config = config.send(RAILS_ENV) |
It’s strange that config.test() work, but confg.send('test') not.
I don’t know why. Can anyone explain this behaivor?
I have expanded your idea into a plugin: http://agilewebdevelopment.com/plugins/application_configuration
I have been using your setup with great pleasure in couple of last projects.
Many thanks!
Karel
]]>