Re: standard ActiveRecord validation message

Chris Hanks
Thu, 25 Jun 2009 16:19:02 -0000

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#errorsadd-to-base

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