当需要主键但未在 schema 或 model 中指定时抛出。
方法
- N
Attributes
| [R] | model |
类公共方法
new(model = nil, description = nil) 链接
来源: 显示 | 在 GitHub 上
# File activerecord/lib/active_record/errors.rb, line 482 def initialize(model = nil, description = nil) if model message = "Unknown primary key for table #{model.table_name} in model #{model}." message += "\n#{description}" if description @model = model super(message) else super("Unknown primary key.") end end