can't modify frozen Hash in mongoid has_one dependent destroy

820 views Asked by At

when I am using mongoid with Rails , I associated my model with has_one relation and used dependent destroy like this

 class MyModel 
   has_one :foo , :dependent => :destroy
 end
 class Foo
   belongs_to :mymodel
 end


 my_model.foo = Foo.new

then the it results the following error

RuntimeError (can't modify frozen Hash):

but if I remove dependent destroy , then no error ... I am not sure why it is

Can anyone please help me ... thanks in advance

0

There are 0 answers