README.rdoc in comma-0.3.1 vs README.rdoc in comma-0.3.2
- old
+ new
@@ -107,14 +107,20 @@
Book.limited(10).to_comma(:brief)
Specifying no description name to to_comma is equivalent to specifying :default as the description name.
-You can pass options for FasterCVS, e.g.
+You can pass options for FasterCSV, e.g.
Book.limited(10).to_comma(:style => :brief, :col_sep => ';', :force_quotes => true)
+You can pass the :filename option and have Comma writes the CSV output to this file:
+
+ Book.limited(10).to_comma(:filename => 'books.csv')
+
+=== USING WITH RAILS
+
When used with Rails (ie. add 'comma' as a gem dependency), Comma automatically adds support for rendering CSV output in your controllers:
class BooksController < ApplicationController
def index
@@ -123,11 +129,25 @@
end
end
end
-If you have any questions or suggestions for Comma, please feel free to contact me at crafterm@redartisan.com, all feedback welcome!
+When used with Rails 2.3.*, Comma also adds support for exporting named scopes:
+ class Book < ActiveRecord::Base
+ named_scope :recent,
+ lambda { { :conditions => ['created_at > ?', 1.month.ago] } }
+
+ # ...
+ end
+
+Calling the to_comma method on the named scope will internally use Rails' find_each method, instantiating only 1,000 ActiveRecord objects at a time:
+
+ Book.recent.to_comma
+
== DEPENDENCIES
-If you're on ruby 1.8.*, the fasterCSV gem is recommended for performance reasons.
+If you're on Ruby 1.8.*, the FasterCSV gem is recommended for performance reasons.
+
gem install fastercsv
+
+If you have any questions or suggestions for Comma, please feel free to contact me at crafterm@redartisan.com, all feedback welcome!