On Mon, Mar 9, 2009 at 10:07 AM, Wes G.
[email protected] wrote:
Is there any way to control the ordering of the error messages in the
output of error_messages_for()?
I want to make the error messages match the order of the form elements
in my form, and although the validates_presence_of directive has these
attributes in that order, they still show up in seemingly random order.
Any way to control this?
I put my error messages right under the fields they are for:
<%= f.username :text_field %>
<% if @user.errors[‘username’] -%>
<%= @user.errors[‘username’] %>
<% end -%>
I did not like error_messages_for() when I first tried and I’ve since
found most of my clients don’t care for it either.