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
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With