ActsAsExportable
Export ActiveRecord table data into a csv.
Install
gem 'acts_as_exportable'
Example
To get started, just specify an ActiveRecord class as acts_as_exportable
This will add all the Object's attributes to the CSV
class Contact < ActiveRecord::Base
acts_as_exportable
end
You can also specify the attributes to be included
class Contact < ActiveRecord::Base
acts_as_exportable :name, :email, :comment
end
At this point the class will be given the "build_csv" class method.
Contact.build_csv
As a convenience a view helper has also been provided.
link_to_export("Link Text", "ClassName", :html_options => {})
This will return a link for downloading the CSV
Copyright (c) 2011 Ross Nelson, released under the MIT license