ruby - Cannot read file #{Rails.root}/RubymineProjects/project2/public/system/resumes/attach_files/1/original/guide.pdf -


i uploaded pdf file during create new employee in employeecontroller after saving .i want download file show.html.erb clicking on name of file. show.html.erb

<tr>     <td><b>resume:</b></td>     <td><%=link_to @employee.resume.attach_file_file_name ,download_employee_path(@employee)  ,:class=> "btn btn-link" %></td>   </tr> 

and method download file defined in employee controller.

employeecontroller.rb

def download     @resume = resume.where(:employee_id=> params[:id] ).first     file_path = @resume.attach_file_file_name     if !file_path.nil?       send_file "#{rails.root}/public/system/resumes/attach_files/#{@resume.id}/original/#{file_path}", :x_sendfile => true, :disposition => 'attachment'     else       redirect_to profile_url     end   end 

resume table in database. association: employee has_one resume.

but not work.the error

cannot read file /rubymineprojects/project2/public/system/resumes/attach_files/1/original/guide.pdf


Comments