[Rails] Custom Validations

Robert MannI
Sat, 01 Apr 2006 20:33:57 -0000

Does anyone how to create a validation that:

validates_presence_of :a  OR :b


I.e. :a OR :b must be present.

I thought this would probably be possible with some kind of validation
callback, e.g.:

def check_a_or_b_is_set
  return (a or b)
end



Any ideas?


Thanks,
Rob
-------------- next part --------------
An HTML attachment was scrubbed...