title: Apparent issue with dup and clone in Rails params
body: <p>I'm in a Rails controller. I try to take some <code>params</code> and change some of the datas to update a model, but I also want to keep the original <code>params</code> untouched.</p>
  
  <p>The logical way to go is to use <code>clone</code> or <code>dup</code> but whatever I try, it fails and changes the original hash.</p>
  
  <pre><code># Original product_params which is set as params.require(:product)
  {"name"=&gt;"Product 2",
   "brand"=&gt;"Brand 2",
   "desc"=&gt;"Placeat a sunt eos incidunt temporibus.\r\n\r\nReprehenderit repudiandae amet quibusdam dolorem et. Itaque commodi at.",
   "hs_code"=&gt;"12212121",
   "options_attributes"=&gt;
    {"0"=&gt;{"name"=&gt;"hkjlVariation 4", "suboptions_attributes"=&gt;{"0"=&gt;{"name"=&gt;"Chkjlhoice 0", "id"=&gt;"582209026b710eded24ecd12"}}, "id"=&gt;"582209026b710eded24ecd13"},
     "1"=&gt;
      {"name"=&gt;"hhVhariation h5kkk",
       "suboptions_attributes"=&gt;{"0"=&gt;{"name"=&gt;"Choice 0kh", "id"=&gt;"582209026b710eded24ecd14"}, "1"=&gt;{"name"=&gt;"hkjChoice 1", "id"=&gt;"582209026b710eded24ecd16"}, "2"=&gt;{"name"=&gt;"kkk"}},
       "id"=&gt;"582209026b710eded24ecd15"},
     "2"=&gt;{"name"=&gt;"lh", "suboptions_attributes"=&gt;{"0"=&gt;{"name"=&gt;"klhj"}}}}}
  
  # Method to change the `suboptions_attributes` to `nil`
  def product_params_without_suboptions
    copy = product_params.dup
    copy.tap do |product_param|
      product_param[:options_attributes].each do |key, option_attribute|
        unless option_attribute[:suboptions_attributes].nil?
          option_attribute[:suboptions_attributes] = nil
        end
      end
    end
  end
  
  # We define product_params
  def product_params
    params.require(:product).permit!
  end
  </code></pre>
  
  <p>The result of <code>product_params_without_suboptions</code> is correct. It set all the <code>option_attribute</code> to <code>nil</code> but when I try to call <code>params</code> or <code>product_params</code> it also changed there. <strong>Why isn't dup working here ?</strong></p>