def download
      response.headers['Content-Length'] = @attachment.file.size.to_s
      send_file(
        @attachment.file.path, {
          filename: @attachment.file_name,
          type: @attachment.file_mime_type
        }
      )
    end
def download
      response.headers['Content-Length'] = @attachment.file.size.to_s
      send_file(
        @attachment.file.path, {
          filename: @attachment.file_name,
          type: @attachment.file_mime_type
        }
      )
    end
sends file as attachment. aka download