Exception: ActiveRecord::FixtureSet::TableRow::PrimaryKeyError
- Inherits:
-
StandardError
- Object
- StandardError
- ActiveRecord::FixtureSet::TableRow::PrimaryKeyError
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/fixture_set/table_row.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(label, association, value) ⇒ PrimaryKeyError
constructor
A new instance of PrimaryKeyError.
Constructor Details
#initialize(label, association, value) ⇒ PrimaryKeyError
Returns a new instance of PrimaryKeyError.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/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 |