2011-10-12 90 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

相关问题