客户端验证gem:错误消息在开发环境中显示两次



我正在使用Rails 3.1.1的客户端验证gem (v3.1.0),每当我选择表单字段时,在我的开发环境中,每个错误消息都会显示两次。在我的登台和生产环境中,它们只显示一次。这简直要把我逼疯了,我不知道为什么。

一个典型的表单字段是这样的:

  <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>

我不明白除了资产管道得到不同的服务之外,开发中发生了什么与登台/生产不同的事情。有人遇到过这种情况吗?我在网上找不到关于它的任何东西

您是否预编译了资产?对我来说,这就是问题所在。只需删除公共/assets文件夹,验证应该只显示一次。

最新更新