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..?
You could store it in the session hash temporarily?
What is it you're trying to achieve?
duplicate_params = params
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
I want to use merge function.. for params.. can I use it.
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.
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>