Paperclip - deleting a photo from a form

Any tips as to how paperclip can be used to delete photos.

I mean that in my update view I show six browse buttons, all capable of
updating the photo that corresponds to that browse button (e.g. photo1
or photo2). That works, what if the user wants to delete one of those
photos, how do I do that?

bb

bingo bob wrote:

Any tips as to how paperclip can be used to delete photos.

I mean that in my update view I show six browse buttons, all capable of
updating the photo that corresponds to that browse button (e.g. photo1
or photo2). That works, what if the user wants to delete one of those
photos, how do I do that?

bb

Looking to find out what I need to do in my view and in my controller.

For reference, here’s the edit view for an advert, as I say, I’m trying
to integrate a fiunction that allows users to delete one of the photos
(1 to 6), any clues as to what i might do in this form / controller.

Editing advert

<%= render :partial => “images”, :locals => { :advert => @advert } %>

<% form_for @advert, :html => { :multipart => true } do |f| %>

<%= f.error_messages %>

  • <%= f.file_field :photo1%>
  • <%= f.file_field :photo2%>
  • <%= f.file_field :photo3%>
  • <%= f.file_field :photo4%>
  • <%= f.file_field :photo5%>
  • <%= f.file_field :photo6%>

<%= f.label :title %>
<%= f.text_field :title %>

<%= f.label :description %>
<%= f.text_area :description %>

<%= f.submit "Update" %>

<% end %>

<%= link_to ‘Show’, @advert %> |
<%= link_to ‘Back’, adverts_path %>

Anyone have any tips on this one? I suppose I may need an additional
action in my controller to cope with deletion of a particular photo and
then re-render the edit view…