當需要主鍵時,但在架構或模型中未指定時引發。
方法
- N
屬性
[R] | model |
類別公用方法
new(model = nil, description = nil) 連結
來源:顯示 | 在 GitHub 上
# File activerecord/lib/active_record/errors.rb, line 448 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