我的应用程序在本地能够正常运行,但是在部署到生产服务器后,当我运行rails server
并请求页面时,出现以下错误:
ActionView::Template::Error (can not load translations from {app}/config/locales/ru.yml, expected it to return a hash, but does not).
我有一个 YAML 翻译 ru.yml:
ru:
clients:
index:
title: Список клиентов
当调用时发生错误,例如:
%h1=t '.title'
我的开发机运行的是Mac OS X ML操作系统
生产服务器是安装了rvm和libyaml的CentOS 6
两台服务器都使用Ruby 1.9.2p320和Rails 3.2.8版本
config/locales/ru.yml
文件时,YAML.load(File.open('config/locales/ru.yml'))
会将该文件加载为YAML格式,并将其转换为Ruby对象。 - KARASZI Istvándefault: %d.%m.%Y %H:%M
- lichdefault: '%d.%m.%Y %H:%M'
,然后得到了一个哈希值。问题解决了,谢谢! - lich