To CSV plugin
Plugin details
Documentation
Install the plugin:
ruby script/plugin install http://svn.integralserver.com/plugins/to_csv
You can simply take a collection of ActiveRecord objects and apply the to_csv method to them:
@users = User.find(:all) @users.to_csv
For a more RESTful way of exporting a CSV, do something like this in your controller:
respond_to do |wants| wants.csv do render :text => @users.to_csv response.headers['Content-Type'] = 'text/csv; charset=iso-8859-1; header=present' response.headers['Content-Disposition'] = "attachment; filename=users_#{Time.now.strftime("%m-%d-%Y")}.csv" end end
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | (0 older versions) | Last edited by: hardway, about 1 year ago

