Why does yaml.dump add quotes this key-value pair

Posted by jason gagne on Stack Overflow See other posts from Stack Overflow or by jason gagne
Published on 2010-03-21T20:12:19Z Indexed on 2010/03/21 20:21 UTC
Read the original article Hit count: 388

Filed under:
|

I'm trying to write a new entry to a rails database.yml and for some reason I'm getting quotes around this entry

db_yml => {'new_env' => {'database' => 'database_name', '<<' => '*defaults' }} File.open("#{RAILS_ROOT}/config/database.yml", "a") {|f| YAML.dump(db_yml, f)}

returns

---
 new_env: 
   database: database_name
   "<<": "*defaults"

I don't know why the "---" and the quotes around the defaults are returned, any thoughts on how to prevent?

thanks!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about yaml