Forum: Ruby on Rails How to have a duplicate copy of params?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
11bbca99cea0c2f3de8cd6de4d20e2d9?d=identicon&s=25 Santosh Turamari (santuhvr)
on 2009-04-22 08:33
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..?
648a71a35ce6e4a1c5cd63451a2a20df?d=identicon&s=25 Gavin Morrice (dr_gavin)
on 2009-04-22 09:36
(Received via mailing list)
You could store it in the session hash temporarily?

What is it you're trying to achieve?
5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2009-04-22 10:11
(Received via mailing list)
duplicate_params = params

2009/4/22 Santosh Turamari <rails-mailing-list@andreas-s.net>
11bbca99cea0c2f3de8cd6de4d20e2d9?d=identicon&s=25 Santosh Turamari (santuhvr)
on 2009-04-22 10:50
Colin Law wrote:
> duplicate_params = params
>
> 2009/4/22 Santosh Turamari <rails-mailing-list@andreas-s.net>

I want to use merge function.. for params.. can I use it.
782b01570270ab10543bc25a258d7ea8?d=identicon&s=25 Dmitry Sokurenko (Guest)
on 2009-04-22 10:50
(Received via mailing list)
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
11bbca99cea0c2f3de8cd6de4d20e2d9?d=identicon&s=25 Santosh Turamari (santuhvr)
on 2009-04-22 11:07
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.
Ae82abddb56f9cc7864d794fa2704dd6?d=identicon&s=25 Wang Pengcheng (Guest)
on 2009-04-23 03:14
(Received via mailing list)
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-
This topic is locked and can not be replied to.