Railsでデータの件数を数える
ActiveRecord::Base.count_by_sql
Module: ActiveRecord::Calculations.count
Person.count(:all, :conditions => "age > 26") # Performs a COUNT(*) (:all is an alias for '*')
paginate_by_sql が欲しいとゆいたいですヽ( ・∀・)ノくまくまー(2005-06-29)
Railsメモ - paginateを任意のSQLで - The ブログ(仮)