ruby on rails - NoMethodError in PaymentsController#summary, undefined method `empty?' for nil:NilClass -
am getting following error:
nomethoderror in paymentscontroller#summary
undefined method `empty?' nil:nilclass extracted source (around line #134):
132 format.pdf 133 pdf = summarypdf.new(@klasses) 134 send_data pdf.render, filename: "payments summary_#{academicterm.current.details}.pdf", type: "application/pdf" 135 end 136 end 137end summarypdf class responsible printing income summary of payments in school. defined under payments controller as
def summary @klasses = klass.all respond_to |format| format.html {render "summary"} format.pdf pdf = summarypdf.new(@klasses) send_data pdf.render, filename: "payments summary_#{academicterm.current.details}.pdf", type: "application/pdf" end end end routes.rb
resources :payments 'search_form', :on=>:collection 'klass_menu',:on =>:collection 'byklass',:on =>:collection 'enrolment',:on =>:collection 'bystudent',:on =>:collection 'with_balance', :on=>:collection 'fully_paid', :on=>:collection 'all_with_balance', :on=>:collection 'all_fully_paid', :on=>:collection 'summary', :on=>:collection so, can me solution?
don't know render method on line 134 sure can call on unsaved summarypdf object? i'd render method needs saved instance of it.
Comments
Post a Comment