Ruby on rails 3.2 can';mongoid中的t modify freezed Hash有一个依赖销毁
当我将mongoid与Rails一起使用时,我将我的模型与has_one关联并使用 像这样毁灭Ruby on rails 3.2 can';mongoid中的t modify freezed Hash有一个依赖销毁,ruby-on-rails-3.2,mongoid3,Ruby On Rails 3.2,Mongoid3,当我将mongoid与Rails一起使用时,我将我的模型与has_one关联并使用 像这样毁灭 class MyModel has_one :foo , :dependent => :destroy end class Foo belongs_to :mymodel end my_model.foo = Foo.new 然后,它会导致以下错误 运行时错误(无法修改冻结哈希): 但是如果我删除依赖销毁,那么没有错误。。。我不知道为什么会这样 谁能帮帮我。。。提前
class MyModel
has_one :foo , :dependent => :destroy
end
class Foo
belongs_to :mymodel
end
my_model.foo = Foo.new
然后,它会导致以下错误
运行时错误(无法修改冻结哈希):
但是如果我删除依赖销毁,那么没有错误。。。我不知道为什么会这样
谁能帮帮我。。。提前谢谢你什么时候打电话来
这似乎是一个众所周知的问题
您到底使用哪个mongo版本?gem'mongoid',“>=3.1.4”我尝试了上面的链接,但没有用,谢谢您的响应self.foo=new\u foo--当我在self类上应用:dependent=>:destroy时,此语句会向我发出错误,但如果我删除dependent destroy,则不会产生错误。。我不知道为什么?有什么想法吗。。。