collection_action :csv_isp_report, method: :get do
@data = []
@isp_manuall = $record_arr
@isp_manuall.map{|isp_manuall| isp_manuall.map { |isp| @data << isp}}
@data_records = @data
csv_string = CSV.generate do |csv|
csv << IspReport.attribute_names
@data_records.each do |ispr|
csv << ispr.attributes.values
end
end
send_data csv_string
end
in View
= link_to "CSV", csv_isp_report_admin_isp_reports_path(format: "csv")
No comments:
Post a Comment