title: How to correctly iterate through params
body: <p>How do I loop through params in my controller so that I can change their values?</p>
  
  <p>This:</p>
  
  <pre><code>...
  params[:contact][:relationships_attributes].each do |rel|
    rel[:contact_ids] = [rel[:contact_ids]]
  end
  ...
  </code></pre>
  
  <p>Returns an Error of:</p>
  
  <pre><code># can't convert Symbol into Integer
  </code></pre>
  
  <p>To provide more context I am using a single select box in place of a multi-select. So the controller is expecting an array but instead its getting a single value.</p>
  
  <p>Here Are My Params:</p>
  
  <pre><code>{"utf8"=&gt;"✓",
  "_method"=&gt;"put",
  "authenticity_token"=&gt;"8FrW59t9vzSep+jEGceMdE/b5q69i5hrEp08yZJJk0o=",
  "contact"=&gt;
    {"first_name"=&gt;"John",
     "last_name"=&gt;"Smith",
     "email_addresses_attributes"=&gt;
      {"0"=&gt;
        {"value"=&gt;"john.smith@gmail.com",
         "type"=&gt;"Home",
         "_destroy"=&gt;"false",
         "id"=&gt;"4f4eea6dbe5a2ccf03000031"
        },
         "1"=&gt;{"value"=&gt;"john@smith.com",
         "type"=&gt;"Home",
         "_destroy"=&gt;"false",
         "id"=&gt;"4f4eea7dbe5a2ccf03000035"
        }
      },
    "phone_numbers_attributes"=&gt;
      {"0"=&gt;
        {"value"=&gt;"555-334-5959",
         "type"=&gt;"Home",
         "_destroy"=&gt;"false",
         "id"=&gt;"4f4eea64be5a2ccf0300002c"}
      },
    "addresses_attributes"=&gt;
      {"0"=&gt;
        {"type"=&gt;"Home",
         "street_address"=&gt;"12345 Any Rd",
         "city"=&gt;"Anytown",
         "state"=&gt;"CO",
         "country"=&gt;"United States",
         "_destroy"=&gt;"false",
         "id"=&gt;"4f4eea64be5a2ccf0300002d"
        }
      },
    "relationships_attributes"=&gt;
      {"1330623965418"=&gt;
        {"contact_ids"=&gt;"4f4e6696be5a2ca2a7000045",
         "title"=&gt;"Wife",
         "_destroy"=&gt;"false"
        }
      }
    },
    "commit"=&gt;"Update Contact",
    "id"=&gt;"4f4e6696be5a2ca2a7000045"
  }
  </code></pre>