开发者

Ruby 1.9.2 patchlevel 180 - libyaml breaks yaml node reference

I used rvm upgrading to 1.9.2-p180. during the installation, libyaml 0.1.3 was fetched and installed.

Now when I have my database.yml in a rails project like this:

defaults: &defaults
  adapter: mysql
  encoding: UTF-8
  username: root
  password:
  host: localhost
  engine: InnoDB

test:
  <<: *defaults
  database: my_app_test

in console,

YAML.load_file("config/database.yml") 

The result is:

{"test" => {"apapter" => "mysql"..开发者_如何学JAVA.}}

The problem is the "database" key is missing. it seems not to merge the defaults node and test node togther, rather it just copy the default node.

any idea?


Anyway, upgrade to ruby-p290 solved the issue.


If I understand you correctly, I can't duplicate that, also using 1.9.2.180:

irb(main):002:0> YAML::load_file('./test.yml')
=> {"defaults"=>{"adapter"=>"mysql", "encoding"=>"UTF-8", "username"=>"root", "password"=>nil, "host"=>"localhost", "engine"=>"InnoDB"}, "test"=>{"adapter"=>"mysql", "encoding"=>"UTF-8", "username"=>"root", "password"=>nil, "host"=>"localhost", "engine"=>"InnoDB", "database"=>"my_app_test"}}

(Scroll right to see: "database"=>"my_app_test"}} )

Not sure if this is an answer as such, but I couldn't put the code in a comment. If I have the wrong end of the stick I'll edit or delete...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜