Module: QuickCount::ActiveRecord::Base::ClassMethods
- Defined in:
- lib/quick_count/active_record/base.rb
Instance Method Summary collapse
Instance Method Details
#quick_count(threshold: nil) ⇒ Object
10 11 12 13 14 |
# File 'lib/quick_count/active_record/base.rb', line 10 def quick_count(threshold: nil) threshold = threshold ? ", #{threshold}" : nil result = ::ActiveRecord::Base.connection.execute("SELECT quick_count('#{table_name}'#{threshold})") result[0]["quick_count"].to_i end |