I am using the client side validations gem (v3.1.0) with Rails 3.1.1 and whenever I tab out of a form field, in my development environment every error message is displayed twice. In my staging and production environments, they are only shown once. This is driving me nuts and I can’t figure out WHY.
A typical form field looks like this:
<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>
After a validation occurs:
<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>
I do not understand what is going on in development that is different from staging/production other than the asset pipeline getting served differently. Has anyone else encountered this? I have not been able to find anything on it in online.
Did you precompile the assets? In my case, that was the problem. Simply remove the public/assets folder and validations should display only once.