Hi all, I wanted to know how to keep a duplicate copy of params which I can use it for another operation, Is there any method..? -- Posted via http://www.ruby-forum.com/.
You could store it in the session hash temporarily? What is it you''re trying to achieve?
duplicate_params = params 2009/4/22 Santosh Turamari <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>> > Hi all, > I wanted to know how to keep a duplicate copy of params which I can > use it for another operation, Is there any method..? > -- > 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Use: params_copy = params.dup then you can change/add/delete items in both hashes (and in nested hashes if any), they are complitely independent. Dmitry
Colin Law wrote:> duplicate_params = params > > 2009/4/22 Santosh Turamari <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>I want to use merge function.. for params.. can I use it. -- Posted via http://www.ruby-forum.com/.
Dmitry Sokurenko wrote:> Use: > > params_copy = params.dup > > then you can change/add/delete items in both hashes (and in nested > hashes if any), they are complitely independent. > > DmitryThank You. -- Posted via http://www.ruby-forum.com/.
Yes, please use the dup method for copy values. Sometimes ,most programmers change to use the ROR because of the Rails. So many of them can''t use the Ruby very well. So I suggest you can study the Ruby now. <Programming Ruby> <The Ruby Programming Language> On Apr 22, 5:07 pm, Santosh Turamari <rails-mailing-l...@andreas- s.net> wrote:> Dmitry Sokurenko wrote: > > Use: > > > params_copy = params.dup > > > then you can change/add/delete items in both hashes (and in nested > > hashes if any), they are complitely independent. > > > Dmitry > > Thank You. > -- > Posted viahttp://www.ruby-forum.com/.