How to have a duplicate copy of params?


#1

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…?


#2

You could store it in the session hash temporarily?

What is it you’re trying to achieve?


#3

duplicate_params = params

2009/4/22 Santosh T. removed_email_address@domain.invalid


#4

Colin L. wrote:

duplicate_params = params

2009/4/22 Santosh T. removed_email_address@domain.invalid

I want to use merge function… for params… can I use it.


#5

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


#6

Dmitry S. 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.


#7

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.

On Apr 22, 5:07 pm, Santosh T. <rails-mailing-l…@andreas-