method

count_by_sql

Importance_1
v1.2.6 - Show latest stable - 1 note - Class: ActiveRecord::Base
count_by_sql(sql) public

Returns the result of an SQL statement that should only include a COUNT(*) in the SELECT part.

  Product.count_by_sql "SELECT COUNT(*) FROM sales s, customers c WHERE s.customer_id = c.id"
Show source
Register or log in to add new notes.