Question

I am currently upgrading my application from rails 2.3 to 3.0 and ruby 1.9.3. After making the required changes and trying to access the home page of my app i'm getting the following error.

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'

The full stack trace can be found at : http://pastie.org/5478123

Line no 73 of en.yml contains

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

Can someone help me in fixing this. Currently myapp is running on Rails 2.3.14 and ruby 1.8.7

Was it helpful?

Solution

Ruby 1.9.3 uses Psych as its Yaml parser, and 1.8.7 used the older and obsolete Syck. The issue you’re seeing is a known issue in LibYaml, the library that Psych is built on, and is due to some ambiguity that arises when colons are allowed in flow context.

There’s a Ruby bug about this.

The solution is to change your Yaml to use the block context:

order: 
  - :year
  - :month
  - :day

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top