title: How to delete attachment using refile ActiveRecord::RecordNotFound
body: <p>I'm trying to delete / destroy an attachment I have uploaded using the refile gem, and I'm currently getting the following error, <code>
  ActiveRecord::RecordNotFound in ImagesController#destroy</code></p>
  
  <p><code>Couldn't find Image with 'id'=</code></p>
  
  <p><strong>images_controller.rb</strong></p>
  
  <pre><code>def destroy
          # binding.pry
          @image = Image.find(params[:id])
          @image.destroy
          flash[:notice] = 'deleted'
          render 'new'
      end
  
      private
  
      def image_params
          params.require(:image).permit(:tshirt_image, :remove_tshirt_image)
      end
  </code></pre>
  
  <p>And the form / view in which I'm trying to delete the attachment looks like,</p>
  
  <p><strong>show.html.erb</strong></p>
  
  <pre><code>&lt;h1&gt;show.html.erb&lt;/h1&gt;
  
  &lt;% debug(@image) %&gt;
  
  &lt;%= image_tag attachment_url(@image, :tshirt_image, :fill, 300, 300, format: "jpg") %&gt;
  
  &lt;%= form_for @image do |form| %&gt;
    &lt;%= form.label :tshirt_image %&gt;
    &lt;% form.attachment_field :tshirt_image %&gt;
  
    &lt;%= form.check_box :remove_tshirt_image %&gt;
    &lt;%= form.label :remove_tshirt_image %&gt;
  
    &lt;%= button_to "delete", @image, method: :delete %&gt;
  
  
  &lt;% end %&gt;
  
  &lt;p&gt;test&lt;/p&gt;
  </code></pre>