Ruby on Rails - send_file is not working

1.1k views Asked by At

I wrote the following code.

def help_doc
  pdf_filename = File.join(Rails.root, "/public/doc.pdf")
  send_file(pdf_filename, :filename => "doc.pdf" :type => "application/pdf", :diposition => "inline")
end

It's working, but not as I want. I'd like to view in the browser the pdf, but it's doing download of the document.

I thought that just writing :disposition => "inline" and I could see on the browser the pdf.

1

There are 1 answers

2
MatthewFord On

Try removing the content disposition. You have a typo in your code, deposition vs disposition, and you're missing a comma after filename.