123456789_123456789_123456789_123456789_123456789_

Exception: ActiveRecord::CompositePrimaryKeyMismatchError

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, ActiveRecordError, StandardError
Instance Chain:
self, ActiveRecordError, StandardError
Inherits: ActiveRecord::ActiveRecordError
Defined in: activerecord/lib/active_record/associations/errors.rb

Class Method Summary

Instance Attribute Summary

Constructor Details

.new(reflection = nil) ⇒ CompositePrimaryKeyMismatchError

[ GitHub ]

  
# File 'activerecord/lib/active_record/associations/errors.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

Instance Attribute Details

#reflection (readonly)

[ GitHub ]

  
# File 'activerecord/lib/active_record/associations/errors.rb', line 188

attr_reader :reflection