[Rails] Custom Validations

Ian White
Sat, 01 Apr 2006 21:20:34 -0000

How about something like:

validates_each :a do |record, attribute, value|
  if value.blank? and record.send(:b).blank?
    record.errors.add_to_base ''a or b required''
  end
end

On 01/04/06, Robert MannI <robmnl@gmail.com>
wrote:
> Does anyone how to create a validation that: