Module: RailsPerformance::Concerns::CsvExportable
- Extended by:
- ActiveSupport::Concern
- Included in:
- BaseController
- Defined in:
- app/controllers/rails_performance/concerns/csv_exportable.rb
Instance Method Summary collapse
Instance Method Details
#export_to_csv(filename, data) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'app/controllers/rails_performance/concerns/csv_exportable.rb', line 7 def export_to_csv(filename, data) return if data.blank? send_data generate_csv(data), filename: "#{filename}_#{Time.zone.today}.csv", type: "text/csv", disposition: "attachment" end |