title: Using a checkbox to delete an object in rails?
body: <p>I've got the following form:</p>
  
  <pre><code>&lt;%= form_for(@subscription = @task.subscriptions.build(:user_id =&gt; subscribers.id)) do |f| %&gt;   
      &lt;%= f.check_box :subscribed, :class =&gt; 'submittable' %&gt;
      &lt;%= f.label :subscribed, subscribers.full_name %&gt;
      &lt;%= f.hidden_field :user_id, :value =&gt; subscribers.id %&gt; 
      &lt;%= f.hidden_field :task_id, :value =&gt; @task.id %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>The 'submittable' class on the checkbox causes the form to be submitted (via jQuery) on update.</p>
  
  <p>:susbcribed is returned via a method in model that returns whether a user is subscribed or not - it cannot be modified directly.</p>
  
  <p>The controller is available here: <a href="http://pastebin.com/zZy6KcXz" rel="nofollow">http://pastebin.com/zZy6KcXz</a> - it is the standard scaffold.</p>
  
  <p>When I click the checkbox, the subcription is successfully created, but I cannot work out how to get it to delete the subscription when unticked.</p>