I'm using rails 3 with devise.
I have a User table with fields: email, password, fname, lname
I currently output errors in my view as follows:
<% if @user.errors.any? %>
<div id="error_explanation" class="error">
<h2>Hold on!</h2>
<ul>
<% @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
Problem is this renders as:
Email The User's Email cannot be blank
Password The User's Password cannot be blank
Fname The User's Fname is too short (minimum 1 characters)
Lname The User's Lname is too short (minimum 1 characters)
How can I get the field name to not appear first with every error?
In my user model I have:
validates :fname, :length => { :minimum => 1, :maximum => 100 } validates :lname, :length => { :minimum => 1, :maximum => 100 }
I can customize those fields with a message attribute. What about email and password which appear to be built into devise? How do I customize those error messages?
Thanks