[Rails] Writing data into yml file in a particular format
Hi,
I have a hash in a controller file which I have to write into a YAML.yml
file in a particular format.
This is the code I am using in the controller to write to yml file.
"File.open("config/locales/output.yml", "w") {|f|
f.write(hash_data.to_yaml) }"
output.yml is the yml file.
hash_data is my hash which has a key having a hash to array of values.
Current output;
---
'01':
- red
- green
Expected output:
en:
01: "red, green"
Is this possible?
Regards,
Nikhil
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home