Rails生成最近12个月的陈述

时间:2014-12-01 19:09:15

标签: ruby-on-rails ruby ruby-on-rails-4 ruby-on-rails-3.2

我的要求是以excel表格的形式提供最近12个月的可下载语句。 我在模型中写了这样的sql语句。我需要一些想法如何动态传递值并将它们分成12个链接以在视图中显示

class AwsCostDetailsController < ApplicationController
  @products = AwsCostDetails.group(:group_name,:cost_date).sum(:unblendedcost)
end

View 
 Jan-14
 Feb-14
 Mar-14
  ....
  ...
 Dec-14

 upon clicking the link the excel file shall be downloaded which will have following columns
   Group Name | Cost | month-year

如何在模型中使用上述方法并在视图中显示上个月的可下载链接。希望我解释得很好。

0 个答案:

没有答案