method

new

Importance_0
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: CompositePrimaryKeyMismatchError
new(reflection = nil) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/associations.rb, line 190
    def initialize(reflection = nil)
      if reflection
        if reflection.has_one? || reflection.collection?
          super("Association #{reflection.active_record}##{reflection.name} primary key #{reflection.active_record_primary_key} doesn't match with foreign key #{reflection.foreign_key}. Please specify query_constraints, or primary_key and foreign_key values.")
        else
          super("Association #{reflection.active_record}##{reflection.name} primary key #{reflection.association_primary_key} doesn't match with foreign key #{reflection.foreign_key}. Please specify query_constraints, or primary_key and foreign_key values.")
        end
      else
        super("Association primary key doesn't match with foreign key.")
      end
    end
Register or log in to add new notes.