现在我在每个控制器中使用# encoding: utf-8
,其中:通知消息不在 latin
我试过把它放在ApplicationController中,尝试在application.html.erb的顶部添加<meta charset="utf-8">
,没有工作,有什么帮助吗?
修改 config.encoding =“utf-8”也在 application.rb
中设置修改
此代码显示错误:
redirect_to root_url, :notice => "Вышли успешно"
这是一个错误
:syntax error, unexpected $end, expecting '}' ..._or_to root_url, :notice => 'Вышли успешно.' }
答案 0 :(得分:2)
这是Set global default encoding for ruby 1.9的副本,但在您的情况下,我建议使用I18n
:
redirect_to root_url, :notice => I18n.t 'sessions.destroy.success'
# config/locales/ru.yml
ru:
sessions:
destroy:
success: Вышли успешно
至于locales键命名,AFAIK没有约定,这里我使用“controller_name.action_name.result”方案。