views:

20

answers:

1

As title says, I have a yaml file with values like

development:

email:[email protected]

test:

email:[email protected]

production:

[email protected]

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 using <%= 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

A: 

You can use:

spec_file = SpecFile['test']['email']
John Topley
Thanks John. That works for me.
RubyNooby