2011-01-24 21 views
0
1 error prohibited this {{model}} from being saved 

    There were problems with the following fields: 

    * {{attribute}} {{message}} 

我得到這個錯誤,代碼我使用的是:Validates_format_of?

validates_format_of :user_id , :with => /\A(([0-9]{4})-[A-Z]{2}$)\Z/ , :message => "should be in the format 1111-TT", :allow_nil => true, :allow_blank => true 

任何想法是什麼引起的?

+0

我很困惑你的問題。你得到什麼錯誤,以及你何時/何時得到它?例如,作爲user_id的值給出了什麼來觸發驗證失敗?我不知道`* {{attribute}} {{message}}`是否是您嘗試用抽象術語或實際錯誤來描述消息。或者是其他東西。這很混亂。 – 2011-01-24 17:44:55

回答

1

我有使用Rails 2和i18n 0.5.0的同樣的問題。卸載i18n 0.5.0或在您的環境中指定舊​​版本(我正在使用0.4.1)。

相關問題