2014-10-09 55 views
3

我有date属性Date类型。simple_form缺少翻译

= f.input :date 

而且simple_form引发了一个异常:

undefined method `map' for "translation missing: fr.date.order":String 

我不应该在默认情况下做任何事情。翻译应该没问题。我不知道我应该寻找什么。

的完整代码视图:

section 
    .row 
    h1= t('actions.new') 

    .row 
    = simple_form_for @group_action, url: admin_actions_path do |f| 
     = f.input :concerned_object 
     = f.input :concerned_company 
     = f.input :date 
     = f.input :amount_estimation 
     = f.input :description 
     = f.input :tags 

     = f.button :submit 

group_action模式:

create_table "group_actions", force: true do |t| 
    t.integer "user_id",      null: false 
    t.datetime "created_at" 
    t.datetime "updated_at" 
    t.string "concerned_object", default: "", null: false 
    t.string "concerned_company", default: "", null: false 
    t.date  "date",       null: false 
    t.string "amount_estimation", default: "", null: false 
    t.text  "description",  default: "", null: false 
    t.string "tags" 
    end 

型号:

class GroupAction < ActiveRecord::Base 
    belongs_to :lawyer, class_name: User, foreign_key: 'user_id' 
end 

一位同事建议我使用order选项一个解决方法:

= f.input :date, order: [:day, :month, :year] 

这摆脱了例外,但我仍然有默认翻译的麻烦。在下面的图片中,它是应该在月份列出的select元素。

enter image description here

+0

你可以发表你的完整的错误消息,并且更多的代码来阐述 – Bijendra 2014-10-09 07:56:04

+0

我没事发布更多的代码,但我不知道该怎么因为我不知道还有什么可以的暗示... – 2014-10-09 08:16:24

+0

@AdrienGiboire请张贴您的整个表格和型号代码 – anusha 2014-10-09 08:19:55

回答

7

如果使用不同的语言环境比:en,你必须安装rails-i18n宝石。

-1

1) 此外,应使用js.coffee,因为使用js.coffee.haml会导致与haml和咖啡冲突。

因此,答案是“不,这似乎并不像您可以使用js.coffee.haml只使用js.coffee.erb这实际上是由扩展js.coffee,在它的一端隐含追加.erb启用。

2) 我是用简单的形式,和我的形式应该是这个样子的,而不是

= simple_form_for @entry, remote: true do |f| 
    = f.input :body 
    = f.button :submit, :disable_with => "Submitting…"