When I click on print button again and again it through an Active Record error
ActiveRecord::RecordNotFound (Couldn't find EmployeeResignation with 'id'=): app/controllers/exit_interviews_controller.rb:67:in `print_exit_interview'
ActiveRecord::RecordNotFound: Couldn't find EmployeeResignation with 'id'=
My Controller Code -
def print_exit_interview
@employee = params[:exit_interview] ? params[:exit_interview][:employee_id] : params[:employee_id]
@employee_resignation = EmployeeResignation.find(params[:id])
@exit_interviews = ExitInterview.where(employee_id: @employee_resignation.employee_id)
respond_to do |format|
format.html
format.pdf do
render :pdf => 'print_exit_interview',
layout: '/layouts/pdf.html.erb',
:template => 'exit_interviews/print_exit_interview.pdf.erb',
:orientation => 'Landscape', # default , Landscape
:page_height => 1000,
:dpi => '300',
:margin => {:top => 20, # default 10 (mm)
:bottom => 20,
:left => 20,
:right => 20},
:show_as_html => params[:debug].present?
end
end
end
In routes I have written post :print_exit_interview .