method
check_validity!
rails latest stable - Class:
ActiveRecord::Reflection::AssociationReflection
check_validity!()public
No documentation available.
# File activerecord/lib/active_record/reflection.rb, line 568
def check_validity!
check_validity_of_inverse!
if !polymorphic? && (klass.composite_primary_key? || active_record.composite_primary_key?)
if (has_one? || collection?) && Array(active_record_primary_key).length != Array(foreign_key).length
raise CompositePrimaryKeyMismatchError.new(self)
elsif belongs_to? && Array(association_primary_key).length != Array(foreign_key).length
raise CompositePrimaryKeyMismatchError.new(self)
end
end
end