Module: ActiveRecordGroupCount::Scope::ExtensionMethods
- Defined in:
- lib/active_record_group_count/scope.rb
Instance Method Summary collapse
Instance Method Details
#count(*args) ⇒ Object
6 7 8 9 10 |
# File 'lib/active_record_group_count/scope.rb', line 6 def count(*args) scope = except(:select).select("1") query = "SELECT count(*) AS count_all FROM (#{scope.to_sql}) x" ActiveRecord::Base.connection.execute(query).first.try(:[], "count_all").to_i end |