Action to Render Image for Download


I’m trying to set up an action that will send an image to the browser as
an attachment for download using paperclip. Sadly, I keep getting
stuck. Insead, I keep sending an empty image to the browser. Anyone
have any luck or any ideas?

def download_image
art = Art.find(params[:id])
send_file art.list_image.url(:original), :type =>
art.list_image_content_type, :disposition => ‘attachment’

Thanks so much.

I got it, with the help of a friend.

send_file art.list_image.path(:original), :type =>
art.list_image_content_type, :disposition => ‘attachment’, :filename =>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs