count(column_name = nil, count_options = {})
public

Count all records using SQL. If the :counter_sql or :finder_sql option is set for the association, it will be used for the query. Otherwise, construct options and pass them with scope to the target class’s count.