Carrierwave de la suppression du fichier

Je l'ai de nouveau besoin de votre aide. Maintenant, j'ai besoin de comprendre comment je peux le supprimer avec Carrierwave les fichiers téléchargés (dans mon cas des images).

modèles/pièce jointe.rb :

class Attachment < ActiveRecord::Base
  belongs_to :attachable, :polymorphic => true
  attr_accessible :file, :file
  mount_uploader :file, FileUploader
end

modèles/post.rb :

class Post < ActiveRecord::Base
  attr_accessible :content, :title, :attachments_attributes, :_destroy
  has_many :attachments, :as => :attachable
  accepts_nested_attributes_for :attachments
end

*views/posts/_form.html.erb :*

<%= nested_form_for @post, :html=>{:multipart => true } do |f| %>
  <% if @post.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>

      <ul>
      <% @post.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div id="field">
    <%= f.label :Nosaukums %>:<br /><br />
    <%= f.text_field :title %><br /><br />
  </div>
  <div id="field">
    <%= f.label :Raksts %>:<br /><br />
    <%= f.text_area :content %><br /><br />
  </div>

    <%= f.fields_for :attachments do |attachment| %>
    <% if attachment.object.new_record? %>
      <%= attachment.file_field :file %>

    <% else %>
      <%= image_tag(attachment.object.file.url) %>
      <%= f.check_box :_destroy %>
    <% end %>
  <% end %>


    <%= f.submit "Publicēt", :id => "button-link" %>
<% end %>

Lorsque j'essaie de supprimer précédent fichier téléchargé, j'ai cette erreur:

unknown attribute: _destroy

Peut-être il y a un problème parce que j'ai plusieurs fichier télécharge pas seul.

OriginalL'auteur RydelHouse | 2013-02-13