This is my shortlisted action and shortlisted.html.erb , when clicked on download the list of shortlisted candidates should get downloaded.
def shortlisted
ids= AppliedJob.shortlisted.pluck(:user_id)
@shortlisted=User.where(id:ids)
respond_to do |format|
format.html
format.pdf do
render pdf: "file_name",
template: 'users/shortlisted',
layout: 'pdf.html.erb',
page_size: 'A4',
disposition: 'attachment',
formats: [:html]
end
end
end
shortlisted.html.erb
<%= link_to "download", shortlisted_path(format: :pdf) %>
