Ruby on rails 创建对象时不显示俄语字符

Ruby on rails 创建对象时不显示俄语字符,ruby-on-rails,ruby,haml,rails-i18n,Ruby On Rails,Ruby,Haml,Rails I18n,轨道3.2 ruby 2.0 有一个表单可用于创建或编辑投票: = f.error_messages header_message: nil = f.input :question, input_html: { class: 'input-block-level' } = f.input :results_hidden, as: :boolean, inline_label: 'Скрыть результаты до окончания опроса', label: false = f.in

轨道3.2

ruby 2.0

有一个表单可用于创建或编辑投票:

= f.error_messages header_message: nil
= f.input :question, input_html: { class: 'input-block-level' }
= f.input :results_hidden, as: :boolean, inline_label: 'Скрыть результаты до окончания опроса', label: false
= f.input :from_date, as: :datetime, input_html: { class: 'poll_date' }
= f.input :to_date, as: :datetime, input_html: { class: 'poll_date' }
%h3#poll-items Варианты ответа (не больше пяти)
.item_index  
  = f.fields_for :poll_items do |poll|
    = render "poll_item_fields", f: poll
  .links
    = link_to_add_association 'Добавить еще вариант', f, :poll_items, render_options: {class: 'links'}
轮询控制器.rb

def update
    if @poll.owner_type == "Post"
      @post = Post.find(@poll.owner_id)
    elsif @poll.owner_type == "BlogPost"  
      @post = BlogPost.find(@poll.owner_id)
    end

    binding.pry
    if @poll.editable?(current_user)
      if @poll.update_attributes params[:poll]
        respond_to do |format|
          format.html { redirect_to @post, notice: 'Опрос был успешно обновлен.' }
        end
      else
        respond_to do |format|
          format.html { render :edit, alert: @poll.errors }
        end
      end
    end
  end
当我在文章中创建或编辑投票时,俄文字符显示为

如果我创建一篇新文章,则所有内容都显示西里尔文。唯一的问题是创建或编辑轮询(Poll)

我浏览了管理控制台mysql。发出请求:
SELECT*FROM polls,其中id=13

问题:"?????三,

在application.rb中:

config.time_zone = 'Moscow'
    config.i18n.locale = :ru
    config.i18n.default_locale = :ru
    config.encoding = "utf-8"
    config.action_dispatch.default_charset = "utf-8"

我使用rake DB:migrate创建了数据库,并在我的数据库中导入sql文件后尝试将其添加到文件顶部
#encoding:utf-8

您必须为俄语设置语言环境…config.i18n.locale=:ru config.i18n.default_locale=:ru-按照文章进行操作。设置db编码后或之前是否创建/迁移了数据库/
schema:load
ed?Mysql可以在某些设置上使用默认的
latin1
,我用rake DB:migrate创建了数据库,在我的DBruby 2+中导入sql文件后不需要它
config.time_zone = 'Moscow'
    config.i18n.locale = :ru
    config.i18n.default_locale = :ru
    config.encoding = "utf-8"
    config.action_dispatch.default_charset = "utf-8"