Exception: ActiveRecord::UnknownPrimaryKey
- Inherits:
-
ActiveRecordError
- Object
- StandardError
- ActiveRecordError
- ActiveRecord::UnknownPrimaryKey
- Defined in:
- activerecord/lib/active_record/errors.rb
Overview
Raised when a primary key is needed, but there is not one specified in the schema or model.
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#initialize(model) ⇒ UnknownPrimaryKey
constructor
A new instance of UnknownPrimaryKey.
- #message ⇒ Object
Constructor Details
#initialize(model) ⇒ UnknownPrimaryKey
Returns a new instance of UnknownPrimaryKey.
187 188 189 |
# File 'activerecord/lib/active_record/errors.rb', line 187 def initialize(model) @model = model end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model
185 186 187 |
# File 'activerecord/lib/active_record/errors.rb', line 185 def model @model end |
Instance Method Details
#message ⇒ Object
191 192 193 |
# File 'activerecord/lib/active_record/errors.rb', line 191 def "Unknown primary key for table #{model.table_name} in model #{model}." end |