Exception: ActiveRecord::FixtureSet::TableRow::PrimaryKeyError
Do not use. This class is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
StandardError
|
|
Instance Chain:
self,
StandardError
|
|
Inherits: |
StandardError
|
Defined in: | activerecord/lib/active_record/fixture_set/table_row.rb |
Class Method Summary
Constructor Details
.new(label, association, value) ⇒ PrimaryKeyError
# File 'activerecord/lib/active_record/fixture_set/table_row.rb', line 43
def initialize(label, association, value) super(<<~MSG) Unable to set #{association.name} to #{value} because the association has a custom primary key (#{association.join_primary_key}) that does not match the associated table's primary key (#{association.klass.primary_key}). To fix this, change your fixture from #{label}: #{association.name}: #{value} to #{label}: #{association.foreign_key}: **value** where **value** is the #{association.join_primary_key} value for the associated #{association.klass.name} record. MSG end