在Mongoid 文档之后,我尝试将哈希数组传递给该create
方法,但它会引发错误。
代码是:
Person.create([
{ first_name: "Heinrich", last_name: "Heine" },
{ first_name: "Willy", last_name: "Brandt" }
])
它抛出以下错误:
NoMethodError: undefined method `keys' for #<Array:0xae4f69c>
跑步:
mongoid-3.0.23
ruby 1.9.3
rails 3.2.13