2011-10-12 93 views
0

我在Rails 3.1.1中使用客戶端驗證gem(v3.1.0),並且每當我在表單字段中選中時,在我的開發環境中,每個錯誤消息顯示兩次。在我的舞臺和製作環境中,它們只顯示一次。這使我瘋狂,我無法弄清楚爲什麼。客戶端驗證gem:錯誤消息在開發環境中顯示兩次

一個典型的表單域看起來是這樣的:

<div class="label"> 
    <label for="user_first_name">First name</label> 
    </div> 
    <div class="field"> 
    <input class="text" data-validate="true" id="user_first_name" name="user[first_name]" size="30" type="text" /> 
    </div> 

後發生驗證:

<div class="label"> 
    <div class="field_with_errors"><div class="field_with_errors"><label for="user_first_name">First name</label></div></div> 
</div> 
<div class="field"> 
    <div class="field_with_errors"><div class="field_with_errors"><input class="text" data-validate="true" id="user_first_name" name="user[first_name]" size="30" type="text"><label for="user_first_name" class="message">can't be blank</label></div><label for="user_first_name" class="message">can't be blank</label></div> 
</div> 

我不明白是怎麼回事的發展是從比其他分期/生產不同資產管道得到不同的服務。有人遇到過這種情況麼?我在網上找不到任何東西。

回答

1

您是否預先編譯了資產?就我而言,這是問題所在。只需刪除公共/資產文件夾,驗證應只顯示一次。

+0

事實上,這是訣竅。非常感謝! – MikeH

相關問題