I am using YAML for configurations in my application. I am using configatron for general configuration. However i have private config values (account_id and password).
I could create a model in database or create a new row in my Setting model. However i prefer to maintain the information on yml
i create my.yml in config and then read on controller
yaml_config = YAML::load(ERB.new(IO.read(File.join(RAILS_ROOT, 'config', 'my.yml'))).result)[RAILS_ENV]
So i want to use my.yml file like configuratron gem does.
i.e I actually load YAML in line and I want config my.field_information.
if I express bad excuse me
Thanks in advance
I am not sure if I understood you correctly, but you want to be able to access your config with attributes?
Then you can do something like this:
this will allow you to access the top level fields as attributes.
for instance if your my.yml file looks like
Then you can access it with
Of course, this is just a crude example. You should add a lot of checks and error handling in case some attributes are missing in the file etc.