The Rails app gives the error "cannot load translations from {ru.yml path}, expecting it to return a hash, but not"

My application works fine locally, but when I install it on a production server, I get the following error: rails server and requesting page:

 ActionView::Template::Error (can not load translations from {app}/config/locales/ru.yml, expected it to return a hash, but does not). 

I have a translation of YAML ru.yml:

 ru: clients: index: title:   

And during the call, an error occurs, for example:

 %h1=t '.title' 

My development machine runs Mac OS X ML

The production server is CentOS 6 with rvm and libyaml installed.

Both servers are on Ruby 1.9.2p320 and Rails 3.2.8

+7
source share
2 answers

The operation YAML.load(File.open('config/locales/ru.yml')) gave me an error in one of the lines.

I added quotes: default: '%d.%m.%Y %H:%M' and got a hash. The problem is resolved.

+5
source

The problem is using the psych YAML mechanism, which cannot parse the% sign strings and throws a SyntaxError exception.

Use the syck engine syck . Add the following code at the end of your config/boot.rb file

 YAML::ENGINE.yamler = 'syck' 
hint

: syck requires Ruby version> = 2.0.0.

+1
source

All Articles