Re: standard ActiveRecord validation message

erwin
Thu, 25 Jun 2009 16:27:44 -0000

Thanks , I just realized that it was not the Model names, but rather
the field names in my User model... you''re right that''s fine
now...

btw , is there any way to  get the error messages in a sequence
similar to the textfields sequence...  ?
I doubt as it''s a hash and so non-ordered , but ...

Erwin

On 25 juin, 18:19, Chris Hanks
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:
> 2 options I can think of:
>
> #1 - change the message of each to "must be selected."
It''s not perfect,
> but the intent of the message is clear.
>
> #2 - define your own validations using errors.add_to_base. See here for
> an
example:http://guides.rails.info/activerecord_validations_callbacks.html#erro...
>
> So, for example, you might try something like:
>
> validate :academy_is_selected
>
> def academy_is_selected
>   errors.add_to_base("You must select an Academy") if
> self.academy.blank?
> end
> --
> Posted viahttp://www.ruby-forum.com/.