title: Passing an array into hidden_field ROR
body: <p>I'm trying to pass an array into a hidden_field.</p>
  
  <p>The following User has 3 roles [2,4,5]</p>
  
  <pre><code>&gt;&gt; u = User.find_by_login("lesa")
  =&gt; #&lt;User id: 5, login: "lesa", email: "lesa.beaupry@gmail.com", crypted_password: "0f2776e68f1054a2678ad69a3b28e35ad9f42078", salt: "f02ef9e00d16f1b9f82dfcc488fdf96bf5aab4a8", created_at: "2009-12-29 15:15:51", updated_at: "2010-01-06 06:27:16", remember_token: nil, remember_token_expires_at: nil&gt;
  &gt;&gt; u.roles.map(&amp;:id)
  =&gt; [2, 4, 5]
  </code></pre>
  
  <p>Users/edit.html.erb</p>
  
  <pre><code>&lt;% form_for @user do |f| -%&gt;
  &lt;%= f.hidden_field :role_ids, :value =&gt; @user.roles.map(&amp;:id) %&gt;
  </code></pre>
  
  <p>When I submit my edit form, I receive an error: ActiveRecord::RecordNotFound in UsersController#update "<strong>Couldn't find Role with ID=245</strong>"</p>
  
  <p>How can I pass an array into the hidden_field?</p>