Notes posted by jamesconroyfinn
RSS feed
0 thanks
Paginating grouped records
If you are grouping similar records and paginating you might need to use :group You’ll want to :select only the field you’re collapsing on probably.
Model.count(:select => :attribute, :group => :attribute)
This will return an OrderedHash of your attributes with a count for each.
{"Column Content" => 6, "Another Column's Content" => 8}
You’ll need a second query to pull all of your records out.