1

谁能向我解释这个运行时异常到底是什么意思?

can't add a new key into hash during iteration

我在这段代码中有这个错误(我使用 Mongoid):

new_item_entries = []

item.entries.each do |entry|
  new_item_entries << ItemEntry.new(name: entry.field) # exception here
end  

self.entries = new_item_entries
self.save

但是这个例外在任何情况下都不会燃烧!在我的 Rspec 测试中,我有 70 次测试中的 3 次失败,但有此例外。大多数测试都使用上面的代码。

4

0 回答 0