Module: CollectionToCsvHelper
- Defined in:
- app/helpers/collection_to_csv_helper.rb
Instance Method Summary collapse
Instance Method Details
#collection_download(collection, column_names = {}) ⇒ Object
2 3 4 5 6 7 |
# File 'app/helpers/collection_to_csv_helper.rb', line 2 def collection_download(collection,column_names={}) klass = collection.try(:first).class raise "#{collection} is not a ActiveRecord collection" unless klass.ancestors.include?(ActiveRecord::Base) collection_ids = collection.map(&:id) link_to "Download" , collection2csv_path(ids: collection_ids,klass: klass,format: "csv",column_names: column_names) end |