我想在AJAX搜索后导出数据,所以我创建了这样的动作(我可以下载后添加搜索条件):
def export
require 'spreadsheet'
@data = Item.all
report = Spreadsheet::Workbook.new
sheet = report.create_worksheet :name => "data"
spreadsheet = StringIO.new
report.write spreadsheet
send_data spreadsheet.string, :filename => "report.xls", :type => "application/vnd.ms-excel"
end
并且文件是空的。我如何传递对象?