title: undefined method `id' for 0:Fixnum when destroy
body: <p>I'm trying to destroy a record in the database, but I'm getting an error I do not understand:</p>
  
  <blockquote>
    <p>undefined method `id' for 0:Fixnum in the view</p>
  </blockquote>
  
  <p>Here is my view:</p>
  
  <pre><code>&lt;%= form_for(:subject, :url =&gt; { :action =&gt; 'destroy' , :id =&gt; @subject.id }) do  %&gt;
      &lt;h2&gt; Are you sure you want to delete &lt;%= @subject.name %&gt; ? &lt;/h2&gt;
      &lt;div class="form-buttons"&gt;
      &lt;%= submit_tag("DELETE") %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Controller actions:</p>
  
  <pre><code>  def delete
      @subject = Subject.delete(params[:id])
    end
  
    def destroy
      @subject = Subject.delete(params[:id]).destroy
      redirect_to(:action=&gt; 'index')
    end
  </code></pre>