Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UTF-8 trouble in rails app when passing to production

I just passed my application in his production environment :

  • debian
  • nginx
  • unicorn
  • mysql

In development I use :

  • mac osx 10.7.3
  • webrick
  • sqlite

I got an error when I go to a view with some UTF-8 chars :

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)>'

I have added this at the top of my file :

# encoding: utf-8

It make it work in my development environment but not in my production envirnoment, any idea ?

EDIT

The error come from here :

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

It doesn't change anything if I change the current locale.

EDIT

I'm using ruby 1.9.3 and rails 3.1.0 I have no view to show because I'm using the ActiveAdmin DSL

like image 869
Awea Avatar asked Nov 05 '22 04:11

Awea


1 Answers

I change mysql in my Gemfile by mysql2

And it work :)

like image 117
Awea Avatar answered Nov 14 '22 22:11

Awea