Forum: Ruby on Rails Validation levels

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
820998d915f73a9db16cac535aee5a99?d=identicon&s=25 Andy Watts (andywatts)
on 2009-01-23 21:25
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."
Dfe81d0ef18761dc22d0586b7b58c5ac?d=identicon&s=25 Rob Zolkos (rzolkos)
on 2009-01-24 01:41
(Received via mailing list)
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...@andreas-s.net>
This topic is locked and can not be replied to.