Exception: ActiveRecord::UnknownPrimaryKey
- Inherits:
-
ActiveRecordError
- Object
- StandardError
- ActiveRecordError
- ActiveRecord::UnknownPrimaryKey
- Defined in:
- lib/active_record/errors.rb
Overview
Raised when a primary key is needed, but not 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 = nil, description = nil) ⇒ UnknownPrimaryKey
constructor
A new instance of UnknownPrimaryKey.
Constructor Details
#initialize(model = nil, description = nil) ⇒ UnknownPrimaryKey
Returns a new instance of UnknownPrimaryKey.
291 292 293 294 295 296 297 298 299 300 |
# File 'lib/active_record/errors.rb', line 291 def initialize(model = nil, description = nil) if model = "Unknown primary key for table #{model.table_name} in model #{model}." += "\n#{description}" if description @model = model super() else super("Unknown primary key.") end end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
289 290 291 |
# File 'lib/active_record/errors.rb', line 289 def model @model end |