ruport应用

1, install:
gem install ruport -y
gem install ruport-util -y


2, require
在 environment.rb 中,写入: require "ruport"

3, Loading acts_as_reportable
在model中: 例如
引用
class Report < ActiveRecord::Base
    acts_as_reportable
end

4, code
在controller中:
引用
def index
      table = Report.report_table(:all,
      nly => %w[host_os rubygems_version user_key],
      :conditions => "user_key is not null and user_key <> ''")
      send_data table.to_csv,
      :type => "application/csv",
      :disposition => "inline",
      :filename => "report.csv"
end


end

你可能感兴趣的:(OS,rubygems,ActiveRecord)