before_filter :configure_charsets将以上内容添加到Application.rb中即可。
def configure_charsets
@response.headers["Content-Type"] ="text/html; charset=utf-8"
# Set connection charset. MySQL 4.0 doesn’t support this so it
# will throw an error, MySQL 4.1 needs this
suppress(ActiveRecord::StatementInvalid) do
ActiveRecord::Base.connection.execute 'SET NAMES UTF8'
end
end
2006/10/17
配置rails使用中文
订阅:
博文评论 (Atom)
Mastodon Daily(2024-04-27)
I just watched The Happening (2008) https://trakt.tv/movies/the-happening-2008 #TheHappe...
-
https://t.co/uNZYlXmkBs 纪录片《老摇滚》,不到1分钟就爆燃,25分钟的时候泪目…… 2017年就要过去了,我很怀念她,也怀念曾经还热爱摇滚乐的日子。 推荐大家看看这部纪录片,在这个辞旧迎新的时刻。 — 零零发 (@linglingfa) Dec...
-
09:26:03: 继续折腾K2P # 09:29:04: I just watched Cape No. 7 (2008...
没有评论:
发表评论