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> 
4

2 に答える 2

0

Ruport はおそらく最良の選択肢ではありません。1年以上更新されていません。それはRubyの世界での一生です。http://ruby-statsample.rubyforge.org/reportbuilder/を参照する か、https ://www.ruby-toolbox.com/ にアクセスして最新のものを見つけてください。

于 2012-03-19T20:49:17.590 に答える
0

エラーを克服するには

undefined local variable or method `report'

"report" の代わりに "@report" を使用する必要がありますか?

于 2013-08-07T15:39:02.337 に答える