加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby – Rails 3 yaml错误

发布时间:2020-12-16 23:01:41 所属栏目:百科 来源:网络整理
导读:我正在升级我的应用程序从rails 2.3到3.0和 ruby 1.9.3.进行所需的更改并尝试访问我的应用程序的主页后,我收到以下错误. Psych::SyntaxError ((/apps/myapp/config/locales/en.yml): did not find expected node content while parsing a flow node at line
我正在升级我的应用程序从rails 2.3到3.0和 ruby 1.9.3.进行所需的更改并尝试访问我的应用程序的主页后,我收到以下错误.
Psych::SyntaxError ((/apps/myapp/config/locales/en.yml): did not find expected node     content while parsing a flow node at line 73 column 14):
/usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/psych.rb:203:in `parse'
/usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
/usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/psych.rb:151:in `parse'
/usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/psych.rb:127:in `load'
/usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/psych.rb:297:in `block in load_file'
/usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/psych.rb:297:in `open'
/usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/psych.rb:297:in `load_file'

完整的堆栈跟踪可以在:http://pastie.org/5478123找到

en.yml的第73行包含

order: [:year,:month,:day]

有人可以帮我解决这个问题.目前,myapp正在Rails 2.3.14和ruby 1.8.7上运行

解决方法

Ruby 1.9.3使用 Psych作为其Yaml解析器,而1.8.7使用了较旧的和过时的Syck.你所看到的这个问题是一个 known issue in LibYaml,Psych是建立在这个图书馆上的,这是由于在流上下文中允许冒号出现的一些歧义.

有一个Ruby bug关于这个.

解决方案是将您的Yaml更改为使用块上下文:

order: 
  - :year
  - :month
  - :day

Rails有changed the template that generated this Yaml to avoid this bug.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读