Ruby on Railsのプロジェクトを日本語で利用するには、まず

config/environment.rbの一番上に追加。


$KCODE = 'utf8'



app/controllers/application.rbに追加。


after_filter :set_charset

def set_charset
content_type = @header['Content-Type'] || 'text/html'
if /^text/\/i//.match(content_type)
@headers['Content-Type'] = "#{content_type}; charset=utf-8"
end
end



何を置いてもまずはこれです。
タグ:日本語 Rails

ブックマークに追加する