I've tought a solution, when it validates, it only takes the first error 
message:

    if obj.errors.on(:email)
    errMsg << obj.errors.on(:email)[0]
    end

Anybody knows a more elegant solution?
greetings!
Luis.

Luis Sánchez wrote:
> First, sorry for my English :S ..
> 
> Hi! I've searched about my problem into the forum but I didn't find any
> post.
> When I fill, for example, an email field my model validates the
> presence, uniqueness, max-length (128) and format (a regular
> expression).
> If a user doesn't fill that field, the validation returns two messages:
>   - The message about the field is blank (yeeeee).
>   - The message about the field haven't the correct format (buuuu).
> I only want to show the first message. Is there any way to do the
> validation sequentially and stop when a validation doesn't be correct?
> an example: first => presence, second => format, third => max-length,
> fourth => uniqueness..
> 
> Last, sorry for my English :S ..
> Thanks!
> 
> Luis

-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to