Module: ActiveRecord::Precount::CollectionProxyExtension
- Defined in:
- lib/active_record/precount/collection_proxy_extension.rb
Instance Method Summary collapse
Instance Method Details
#count(*args) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/active_record/precount/collection_proxy_extension.rb', line 6 def count(*args) return super if args.present? counter_name = :"#{@association.reflection.name}_count" if ReflectionChecker.count_loaded?(@association.owner, counter_name) @association.owner.association(counter_name).target else super end end |