On 6 Dec 2008, at 23:42, jim wrote: > > @ticket = Ticket.find(params[:id]) > @line_items = @ticket.line_items > > I think my problem is that I don't understand what is happening here. > I thought this said: > > 1) ok, look up the ticket you want to work on, and here's the original > line_items for the ticket. > 2) now manipulate those via the params from the form ... > There's two levels of trickery here. First @ticket.line_items isn't an array. At this point the line items have not been loaded. It's a magical association proxy. Even if you were to sidestep that, you're still not copying the array. To put things another way, is
a = [1,2,3] b = a Then b and a are exactly the same array: b << 4 a #=> [1,2,3,4] > I tried stuff like: > > orig_line_items = @ticket.line_items > > orig_line_items = Array.new(@line_items) Creating a new Array like that (or duping the original array) should work. I suspect that since you seemed to have been changing stuff slightly in desperation you did something else at the same that clouded the issue. Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---