method
check_validity!
Ruby on Rails latest stable (v7.1.3.2)
-
0 notes -
Class: ActiveRecord::Reflection::AssociationReflection
check_validity!()
public
Hide source
# 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