0

I used the paperclip module with amazon s3 server for storing images.

I can uploaded an image successfully with below line.

album_photo.avatar.url(:original)

But how can I delete this image from S3? I don't know how.

I call a simple destroy method like below:

def destroy
  @album.destroy    
  respond_to do |format|
    format.js
  end
end

But it only delete the image from the DB not from S3.

I referred to Paperclip - delete a file from Amazon S3? link but I don't understand.

So what am I missing?

Community
  • 1
  • 1
Jiggs
  • 518
  • 7
  • 22
  • http://stackoverflow.com/questions/4435826/rails-paperclip-how-to-delete-attachment – Gopal S Rathore Jun 04 '15 at 13:35
  • just delete that activerecord ..paperclip will automatically delete from AWS.For associated models.it will work too if you have added dependent: destroy. – Milind Jun 04 '15 at 14:38

1 Answers1

1

Try ,it should automatically delete it.

<%= link_to "delete your photo", photo_path, method: :delete, data: { confirm: "Are you sure?" }%>

Mike McCallen
  • 307
  • 1
  • 14