2017-06-21 113 views
0

我正在使用phonelib gem進行電話號碼驗證。 在我的用戶模型,user.rbRails:僅在生產中出現重複驗證錯誤消息

validates :phone, phone: { allow_blank: true, message: "Please enter valid contact number" } 

_form.html.erb

<%= f.number_field :phone, :maxlength => '16', class: 'phone-number' %> 
<%= f.error_message_on :phone %> 

當用戶進入我收到錯誤消息無效的電話號碼,「請輸入有效的聯繫電話」兩次。 enter image description here

我也有另一種驗證

validates_presence_of :company_type, message: 'Please enter your company type' 

,並在我的部分

<%= f.select :company_type, [], { prompt: false }, class: 'company-type' %> 
<%= f.error_message_on :company_type %> 

enter image description here

奇怪的是這種情況只在生產,而不是在開發環境。任何人都可以幫我弄清楚是什麼導致了這種行爲?提前致謝。

+0

你可以嘗試在生產環境中,以啓動軌道服務器和跟蹤這個bug下來 –

回答