class AtLeastOneOfValidator
Public Instance Methods
Source
# File lib/at_least_one_of_validator.rb, line 8 def validate_each(record, attribute, value) attributes = options[:in] + [attribute] if attributes.all? { |name| record.try(name).nil? } record.errors.add(attribute, "is required because at least one of #{attributes.to_sentence} are required") end end