Class: MutuallyExclusiveWithValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Includes:
ActiveSupport::Inflector
Defined in:
app/validators/mutually_exclusive_with_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, _value) ⇒ Object



4
5
6
7
8
9
# File 'app/validators/mutually_exclusive_with_validator.rb', line 4

def validate_each(record, attribute, _value)
  other_attribute = options[:with]

  validate_mutual_exclusivity(record, attribute, other_attribute)
  validate_mutual_exclusivity(record, other_attribute, attribute)
end