Application Configuration
common: support_email: admin@myhost.com root_url: myhost.com photos_max_number: 6 production: email_exceptions: true development: root_url: localhost:3000 photos_max_number: 10
In your application, it’s pretty simple to get at these values. Each value specified is stored as a member in the ::AppConfig structure:
AppConfig.photos_max_number AppConfig.email_exceptions
I did run into one problem using the plugin; it uses config as the name of the structure, which conflicts with Rails, or some other gem that I’m using. I edited the plugin source and changed the name of the struct to AppConfig and now I’m happily keeping my configuration data DRY.
Filed under: Rails

Leave a Reply