Class: AssociationLengthValidator

Inherits:
ActiveModel::Validations::LengthValidator
  • Object
show all
Defined in:
lib/association_length_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



3
4
5
6
7
8
# File 'lib/association_length_validator.rb', line 3

def validate_each(record, attribute, value)
  value = value.reject(&:marked_for_destruction?)
  value = select_items(record, value, options[:select]) if options[:select]

  super(record, attribute, value)
end