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.
Santosh T. (Guest)
on 2009-04-22 10: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..?
Gavin M. (Guest)
on 2009-04-22 11:36
(Received via mailing list)
You could store it in the session hash temporarily?

What is it you're trying to achieve?
Colin L. (Guest)
on 2009-04-22 12:11
(Received via mailing list)
duplicate_params = params

2009/4/22 Santosh T. <removed_email_address@domain.invalid>
Santosh T. (Guest)
on 2009-04-22 12:50
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.
Dmitry S. (Guest)
on 2009-04-22 12: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
Santosh T. (Guest)
on 2009-04-22 13:07
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.
Wang P. (Guest)
on 2009-04-23 05: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 P.ming Language>

On Apr 22, 5:07 pm, Santosh T. <rails-mailing-l...@andreas-
This topic is locked and can not be replied to.