Often I just show the first element in the error_messages array unless
that array is nil
On Jan 24, 7:25 am, Andy Watts
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Sometimes I want to show just one error, even when a field fails two or
> three validations.
>
> A custom validation method is easy enough, but the helpers are nice and
> concise.
> So, has anyone found a way of doing this with AR''s validation
helpers?
> The :if/:unless look promising, but its made harder by validations being
> applied in a random order.
>
> - Andy
>
> P.s. The validatable gem has the excellent ''level'' option
on it''s
> validation helpers. http://validatable.rubyforge.org/
> "Validations can be given levels. If a validation fails on a level the
> validations for subsequent levels will not be executed."
> --
> Posted viahttp://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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---