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?

-- 
Posted via http://www.ruby-forum.com/.

-- 
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/1b6e74ac6dd6b8c23b694a41297645e4%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to