As title says, I have a yaml file with values like
development:
email:dev@abc.com
test:
email:test@abce.com
production:
prod@abc.com
and i load this file in an rb file located under "initializers" directory as
SpecFile = YAML.load_file("#{RAILS_ROOT}/config/application.yml")
Question is, I need to access these values in my models and controller files. In html, I refer thme u开发者_StackOverflowsing <%= SpecFile['test']['email']%> which i am not sure is the correct way or not. (I use ror 1.8.7)
Any help is appreciated
Thanks
You can use:
spec_file = SpecFile['test']['email']
- See my answer here for full details.
精彩评论