Get an array from a Rails form <p>I need to design a form for a <code>account</code> resource. In that form, i need to collect some set of ids as an array in the <code>params</code> hash in attribute called <code>relationships</code>. So the final <code>params[account]</code> hash from the POST request should be like </p> <p><code>{:name =&gt; 'somename', :relationships =&gt; ["123", "23", "23445"]}</code></p> <p>How shall I design the form_for fields. I tried this, but didn't work.</p> <pre><code>&lt;%= form_for @account do |f| %&gt; &lt;%= f.text_field :name %&gt; &lt;% @eligible_parents.each do |p| %&gt; &lt;%= f.check_box "relationships", nil, :value =&gt; p.id %&gt; &lt;b&gt;&lt;%= p.name %&gt;&lt;/b&gt;&lt;br/&gt; &lt;/span&gt; &lt;% end %&gt; &lt;%= f.submit "Submit" %&gt; &lt;% end %&gt; </code></pre> <p>Number of elements in <code>@eligible_parents</code> varies every time. <code>relationships</code> is neither an association nor an attribute in <code>account</code> model. I have to use virtual attributes but I need to fill in an array from a form. Please help. How can I do this? </p>