gpt4 book ai didi

ruby-on-rails - 传递到生产环境时,rails 应用程序中的 UTF-8 问题

转载 作者:行者123 更新时间:2023-12-04 21:22:36 27 4
gpt4 key购买 nike

我刚刚在他的生产环境中通过了我的应用程序:

  • debian
  • nginx
  • unicorn
  • mysql

  • 在开发中我使用:
  • mac osx 10.7.3
  • webrick
  • sqlite

  • 当我转到带有一些 UTF-8 字符的 View 时出现错误:
    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)>'

    我在我的文件顶部添加了这个:
    # encoding: utf-8

    它使它在我的开发环境中工作,但在我的生产环境中不起作用,知道吗?

    编辑

    错误来自这里:
    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

    如果我更改当前语言环境,它不会改变任何内容。

    编辑

    我正在使用 ruby​​ 1.9.3 和 rails 3.1.0
    我没有要显示的 View ,因为我正在使用 ActiveAdmin数字用户线

    最佳答案

    我换 mysql 在我的 Gemfile 中 mysql2

    它工作:)

    关于ruby-on-rails - 传递到生产环境时,rails 应用程序中的 UTF-8 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9498583/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com