Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Mongoid+;ActiveModel验证&x2B;I18n,未正确转换属性_Ruby On Rails_Ruby_Internationalization_Mongoid_Activemodel - Fatal编程技术网

Ruby on rails Mongoid+;ActiveModel验证&x2B;I18n,未正确转换属性

Ruby on rails Mongoid+;ActiveModel验证&x2B;I18n,未正确转换属性,ruby-on-rails,ruby,internationalization,mongoid,activemodel,Ruby On Rails,Ruby,Internationalization,Mongoid,Activemodel,我正在尝试国际化我的预订模型的属性 从我的fr.yml: attributes: &attributes booking: first_name: 'Prénom' last_name: 'Nom' email: "Email" phone: 'Téléphone' activemodel: errors: <<: *errors attributes: <<

我正在尝试国际化我的
预订
模型的属性

从我的fr.yml:

  attributes: &attributes
    booking:
      first_name: 'Prénom'
      last_name: 'Nom'
      email: "Email"
      phone: 'Téléphone'

  activemodel:
    errors:
      <<: *errors
    attributes:
      <<: *attributes
但是:

但是,在我的web服务器上,错误仍然是英语+法语,例如:

“名字doitêtrerempli(e)”

我错过了什么?我正在使用mongoid、ruby 2.0.0和rails 3.2.11

请注意,我正在使用
model.errors.full_messages
检索错误消息。

修复了它:

mongoid:
  attributes:
    <<: *attributes
mongoid:
属性:
2.0.0p0 :013 > Booking.human_attribute_name('first_name')
 => "First name"
mongoid:
  attributes:
    <<: *attributes