我有一个 ActiveRecord::Base 子类。当我创建一个新实例时,我收到一个参数错误:
ArgumentError:
wrong number of arguments (2 for 1)
这是我的代码:
class Subclass < ActiveRecord::Base
end
Subclass.new(hash, without_protection: true)
宝石版本是:
activemodel (3.2.13)
activerecord (3.2.13)
为什么这会产生和争论错误?根据 API Dock,从 3.2.13 开始,initialize 仍然需要两个参数