charlotte-ruby/impressionist — pull request #37 by rossta (2012-03-19 22:37:08+00:00)
Title: Optimize impressionist_count query via arel count with distinct option

I don't want to load impressions in memory to obtain the count, so I'm suggesting use of the :distinct option with a call to arel count instead. It omits items from the count when the value is nil (which I believe is a desired outcome), so I set the request_hash in the counter cache test.