I implemented a show action to retrieve a pdf file url
 namespace :api do
   namespace :v2 do
     get '/patients/:id', to: 'patients#show'
   end
 end
http://localhost:3005/api/v2/patients/1894
{
    "id": 1894,
    "name": "Test",
    "file": {
        "url": "https://some-url-com"
    },
    "student_id": 20998,
    "created_at": "2019-07-02T13:27:10.975-04:00",
    "updated_at": "2019-07-02T13:54:53.248-04:00",
    ....
    ....
}
If a user accesses the show link then it should just return pdf file. I am trying to open pdf from the show endpoint. I tried following methods in controller but not having luck
patient = Patient.find(params[:id])
open(patient.file.url).read
also tried send_file
send_data patient.file.url, :type => "application/pdf", :disposition => 'attachment'
but not having luck. Is there any way I can have show url return pdf?
 
     
    