ActiveRecord class method count issues

What's your Rails version?
You need to have ActiveRecord::Calculations module (Rails > 1.1).

Do you have output debug from the db?