0

I'm using the gem datagrid to display some data. I would like to use ruport to output the data to pdf.

I added this button to my controller.rb=

<%= button_to "PDF", {:controller => :admin_reports, :action => :worequest_pdf }%>

I have this route=

resources :admin_reports do
post :worequest_pdf, :on => :collection

end

And this in the admin_reports_controller.rb=

 def worequest_pdf
f = File.new("worequest.pdf", "w")
f.write Ruport::Data::Table(:column_names =>report.header, :data => report.rows).to_pdf
f.close

end

But, it doesn't work - any ideas? I get:

undefined local variable or method `report' for #<AdminReportsController:0x007fc463566218> 
rep
  • 1,546
  • 1
  • 12
  • 19
Reddirt
  • 5,913
  • 9
  • 48
  • 126

2 Answers2

0

To overcome the error

undefined local variable or method `report'

Should you be using "@report" instead of "report"?

Zack Xu
  • 11,505
  • 9
  • 70
  • 78
0

Ruport probably is not your best option. It has not been updated in more than a year. Thats a lifetime in the ruby world. You may want to look at http://ruby-statsample.rubyforge.org/reportbuilder/ or go to https://www.ruby-toolbox.com/ to find something more up to date.

Antarr Byrd
  • 24,863
  • 33
  • 100
  • 188