This project is archived and is in readonly mode.

#2395 ✓resolved
Jan Xie

count method doesn't work with specified conditions

Reported by Jan Xie | April 2nd, 2009 @ 08:15 AM | in 3.x

AssociationCollection#count method won't take conditions in arguments into account if there is finder_sql or counter_sql. e.g.

class User has_many :photos, :finder_sql => '...' end

some_user.photos.count(:conditions => ['photos.created_at > ?', Time.today]) # all user photos will be returned, not only those created today

I wrote a patch to fix this (compatible with older implementation)

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages