目前我正在将我的 Rails 应用程序从 rails 3 升级到 rails 4,并且在运行服务器后使用电子表格(0.7.1)我得到 了 main::object 的未定义方法“send_file”, 这是我的代码:
def financial_export_excel
book = Spreadsheet::Workbook.new
sheet = book.create_worksheet
sheet.merge_cells(5, 0, 6, 0)
sheet.merge_cells(5, 1, 6, 1)
sheet.merge_cells(5, 2, 6, 2)
sheet.merge_cells(5, 3, 6, 3)
sheet.merge_cells(5, 4, 6, 4)
sheet.merge_cells(5, 5, 6, 5)
sheet.merge_cells(5, 6, 6, 6)
sheet.merge_cells(5, 7, 6, 7)
sheet.merge_cells(5, 8, 6, 8)
book.write "sample.xls"
send_file "sample.xls"
File.delete "sample.xls"
end
有什么帮助吗?