On Wednesday, 23 July 2014 08:23:25 UTC-4, Ruby-Forum.com User wrote: > > Matt Jones wrote in post #1152815: > > On Friday, 18 July 2014 02:24:59 UTC-4, Ruby-Forum.com User wrote: > > saved_children = pfrom.children.to_a > > pfrom.children = [] > > pto.children = pto.children + saved_children. > > I finally found the time to rewrite this part of my application > according to this suggestion, but I now get an error "can't modify > frozen Hash", when I try to add the saved children. The actual code > which I am using is here: > > # tempdict is "pfrom" and targetdict is "pto" > targetdict=Dict.find_by_id(....) > # creating and saving a tempdict together with several children, > i.e. cards > tempdict=Dict.new(....) > tempdict.save! > # Code for creating and adding the children omitted for brevity > .... > cards_to_add=tempdict.cards.to_a > tempdict.cards=[] > targetdict.cards += cards_to_add > > I find it strange that I get the error on the last line. The error > message is usually an indication that I am trying to save something > which has been deleted already, but in this case, no deletion had been > done on 'targetdict' before. > > Any idea, where this error could come from? > > You tell me; you're the one who can see the stack trace. :)
Maybe something that it's modifying has been destroyed? --Matt Jones -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/99baf55b-11f2-4ea1-b7db-41971e97cf75%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.