Order of error_messages_for

Is there a mean to specify the messages order that are displayed by a

I see that we can specify the objects order. But what about the
messages related to a same object.

Let say I have an Order.

In my form I have the following order:
Payment type

and in my model I have:
validates_presence_of :name, :address, :email, :pay_type
validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+.)+

However I get the following order for the error messages:
* Name can’t be blank
* Pay type can’t be blank
* Address can’t be blank
* Email is invalid
* Email can’t be blank

Obviously I would like the same order as in the form.

Is it possible with error_messages_for ?

On 1/28/07, oscarpica [email protected] wrote:

* Name can’t be blank

You could use:

<%= error_message_on :order, :name %>
<%= error_message_on :order, :address %>
<%= error_message_on :order, :email %>

Hope this helps.

Zack C.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs