Rails : Loading configuration from custom yml file
Recently while I was working on a rails project I need to use a lot of custom project configurations. when I checked on web I found rails_config
gem. But my colleague, proposed me another easy way to do it. Since I just need to load all the configs as an hash to a variable, I don't really need rails_config.
Now we can use CONFIG variable in any where in the project. We can get the configuration of foo as CONFIG["foo"]Thank You Happy Coding ;)
create config.yml in config/ folderHere is sample config.yml
Here I just defined the separate config for each envirnment, which is easy to maintain later.
create config.rb in config/initializers/ folder with below content
If you particularly enjoy my work, I appreciate donations given with Gittip.