title: Rails forms - When no checkboxes are checked, param is not included in POST
body: <p>I have a Task model, which is joined in a many-to-many relationship with an Objective model.</p>
  
  <p>I have a Task edit form where a user can associate any Objective with a Task via checkboxes. When a checkbox is checked, it should indicate an association between the Task and a particular Objective; when a checkbox is not checked, there should be no association. This should be persisted to the database when the form submits.</p>
  
  <pre><code>&lt;%= form_for @task do |f| %&gt;
    &lt;% Objective.all.each do |objective| %&gt;
      &lt;%= check_box_tag :objective_ids, objective.id, @task.objectives.include?(objective), :name =&gt; 'task[objective_ids][]' %&gt;
    &lt;% end %&gt;
    &lt;%= f.button :submit %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Updating a Task seems to work absolutely fine <em>as long as one checkbox is checked by the user</em>, but when  the user does not check any checkboxes, the <code>:objective_ids</code> param (which is an array of Objective ids) is not included in the POST action at all. Because of this, when I do <code>@task.update_attributes(params[:task])</code> in the controller, the Task's collection of Objectives is not updated (i.e. the Task should no longer have any Objectives associated with it, because no checkboxes were checked).</p>
  
  <p>So how can I ensure the <code>:objective_ids</code> param is included in the POST, even if only as an empty array?</p>