Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 3.2 can';mongoid中的t modify freezed Hash有一个依赖销毁_Ruby On Rails 3.2_Mongoid3 - Fatal编程技术网

Ruby on rails 3.2 can';mongoid中的t modify freezed Hash有一个依赖销毁

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 然后,它会导致以下错误 运行时错误(无法修改冻结哈希): 但是如果我删除依赖销毁,那么没有错误。。。我不知道为什么会这样 谁能帮帮我。。。提前

当我将mongoid与Rails一起使用时,我将我的模型与has_one关联并使用 像这样毁灭

 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,则不会产生错误。。我不知道为什么?有什么想法吗。。。