Method used to download the attachment when user clicks download link. It return attachment information with its url and if it is image it will also return its type and style.
# File app/controllers/attachments_controller.rb, line 10 def download attachment = Attachment.find(params[:id]) if attachment.has_access_to? current_user if attachment.image? send_data File.read(attachment.attachment.path(params[:style] || :original)), type: attachment.attachment_content_type, disposition: 'inline', url_based_filename: true else send_file attachment.attachment.path, :type => attachment.attachment_content_type end else render_404 end end