a better to_csv plugin
This is 90% a rip-off from the Active Record Extensions by Zach Dennis version of to_csv but extracted out and updated a bit (to rails 2.0 and a bit more friendly with your models).
It depends on fastercsv, a gem.
How it works
1 2 3 4 5 6 7 8 9 |
# just do the thang @reports.to_csv # include a relation @reports.to_csv(:include => :reporter) # change the column headers @reporters.to_csv(:headers => {'Contact Last Name' => 'last_name', 'Contact First Name' => 'first_name', 'Contact Email' => 'email'}) |
Try it out
1 2 3 |
sudo gem install fastercsv script/plugin install svn://svn.joots.com/public/plugins/to_csv |
0 comments