9

My application works fine locally, but when i'm installing it to production server, i get the following error running 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 YAML translation ru.yml:

ru:
  clients:
    index: 
      title: Список клиентов

And error happens while calling, ex:

%h1=t '.title'

My development machine is running Mac OS X ML

Production server is CentOS 6 with rvm and libyaml installed.

Both servers are on Ruby 1.9.2p320 and Rails 3.2.8

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
lich
  • 290
  • 1
  • 5
  • 10

2 Answers2

5

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

I added quotes: default: '%d.%m.%Y %H:%M' and got a hash. Problem is solved.

lich
  • 290
  • 1
  • 5
  • 10
1

The problem is about using psych YAML engine which can not parse strings with % sign and generates SyntaxError exception.

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

YAML::ENGINE.yamler = 'syck'

hint: syck requires Ruby version >= 2.0.0.

Community
  • 1
  • 1
fey
  • 1,289
  • 1
  • 10
  • 20