I need to store app specific configuration in rails. But it has to be:
- reachable in any file (model, view, helpers and controllers
- environment specified (or not), that means each environment can overwrite the configs specified in environment.rb
I’ve tried to use environment.rb and put something like
USE_USER_APP = true
that worked to me but when trying to overwrite it in a specific environment it wont work because production.rb, for instance, seems to be inside the Rails:Initializer.run block.
So, anyone?
I was helping a friend set up the solution mentioned by Ricardo yesterday. We hacked it a bit by loading the YAML file with something similar to this (going from memory here):
This allowed him to embed Ruby code in the config, like in Rhtml: