传递给生产时,rails app中的UTF-8出现问题

Awe*_*wea 5 ruby-on-rails utf-8 activeadmin

我刚刚在他的生产环境中传递了我的应用程序

  • Debian的
  • nginx的
  • 独角兽
  • MySQL的

在开发中我使用:

  • mac osx 10.7.3
  • 使用WEBrick
  • 源码

当我使用一些UTF-8字符查看视图时出错:

ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT):
    1: render renderer_for(:new)
  app/admin/projects.rb:122:in `block (2 levels) in <top (required)>'
Run Code Online (Sandbox Code Playgroud)

我在我的文件顶部添加了这个:

# encoding: utf-8
Run Code Online (Sandbox Code Playgroud)

它使它在我的开发环境中工作,但不是在我的生产环境中,任何想法?

编辑

错误来自这里:

f.has_many :roles do |app_f|
  app_f.inputs do
    # if object has id we can destroy it
    if app_f.object.id
      app_f.input :_destroy, :as => :boolean, :label => "Supprimer l'utilisateur du projet"
    end
    app_f.input :user,      :include_blank => false, :label_method => :to_label
    app_f.input :role_name, :include_blank => false 
    #app_f.input :role_level, :label => 'Author type',  :as => :select, :include_blank => false, :collection => Role::role_list
  end
end
Run Code Online (Sandbox Code Playgroud)

如果我更改当前区域设置,它不会更改任何内容.

编辑

我正在使用ruby 1.9.3和rails 3.1.0我无法显示,因为我正在使用ActiveAdmin DSL

Awe*_*wea 2

我通过mysql2在 Gemfile 中更改了mysql

它有效:)