aggregate(query.merge(:fields => [ property_name ? property_name.count : :all.count ])).to_i
to aggregate(query.merge(:fields => [ property_name ? property_name.count : :all.size ])).to_i might be more conservative. thanks for all the input. On Feb 24, 11:45 pm, Ming <min...@gmail.com> wrote: > I opened a ticket. > > Until something official happens, I'm patching my > aggregate_functions.rb to get it working for my project: > > aggregate(query.merge(:fields => [ property_name ? > property_name.count : :all.count ])).to_i > > to > > aggregate(query.merge(:fields => [ property_name ? > property_name.size : :all.size ])).to_i > > On Feb 24, 7:31 am, Ming <min...@gmail.com> wrote: > > > > > This is related to the problem and fix posted over a year ago: > > >http://groups.google.com/group/datamapper/browse_thread/thread/503cfb... > > > dkubb commented out the optimization of size calling count > > > > > http://github.com/datamapper/dm-more/commit/35ac591458ba477c875b3541f... > > > to use Array#size to properly recognize :limit in the query. > > > Shouldn't count also recognize limit in the query? I was confounded > > by dm-pagination's refusal to reflect my :limit in the total page > > (record) count. dm-pager perhaps shouldn't use count that way, but > > somebody passing a query with a limit should expect to have it > > recognized, as with .size. > > > http://github.com/visionmedia/dm-pagination/blob/master/lib/dm-pager/... > > > -M -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to datamap...@googlegroups.com. To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.