The upcoming 0.2.0 release will update the to_csv and to_csv_file method arguments.
# rather then array_of_models.to_csv( :headers => [ :field1, :field2, :field3 ] ) # it'll be array_of_models.to_csv( :headers => true|false, :only=> [ :field1, :field2, :field3 ] ) # or array_of_models.to_csv( :headers => true|false, :except=> [ :id ] ) # and the same goes for the options that were passed into to_csv_file as well array_of_models.to_csv_file( filename, :headers=>[ :name, :salary ] )
Thanks to Dan Kubb for bringing this up. The API is borrowed from Chris Abad’s “ToCSV plugin.”:http://blog.integralimpressions.com/articles/2006/09/01/tocsv-plugin
After that I’ll be on holiday vacation and I hope to kick out some cool stuff, like the :include option that Dan Kubb “mentioned.”:http://rubyforge.org/tracker/?atid=8256&group_id=2113&func=browse for the to_csv.
blog comments powered by Disqus