Exception: ActiveRecord::FixtureSet::TableRow::PrimaryKeyError
- Inherits:
-
StandardError
- Object
- StandardError
- ActiveRecord::FixtureSet::TableRow::PrimaryKeyError
- Defined in:
- activerecord/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 'activerecord/lib/active_record/fixture_set/table_row.rb', line 43 def initialize(label, association, value) super(" Unable to set \#{association.name} to \#{value} because the association has a\n custom primary key (\#{association.join_primary_key}) that does not match the\n associated table's primary key (\#{association.klass.primary_key}).\n\n To fix this, change your fixture from\n\n \#{label}:\n \#{association.name}: \#{value}\n\n to\n\n \#{label}:\n \#{association.foreign_key}: **value**\n\n where **value** is the \#{association.join_primary_key} value for the\n associated \#{association.klass.name} record.\n MSG\nend\n") |