Class: ActiveRecord::Validations::LengthValidator

Inherits:
ActiveModel::Validations::LengthValidator
  • Object
show all
Defined in:
lib/active_record/validations/length.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, association_or_value) ⇒ Object



4
5
6
7
8
9
# File 'lib/active_record/validations/length.rb', line 4

def validate_each(record, attribute, association_or_value)
  if association_or_value.respond_to?(:loaded?) && association_or_value.loaded?
    association_or_value = association_or_value.target.reject(&:marked_for_destruction?)
  end
  super
end