Module: ActiveRecordExtensions::DetachedCounterCache::HasManyAssociation
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/detached_counter_cache.rb
Instance Method Summary collapse
Instance Method Details
#count_records_with_detached_counters ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/detached_counter_cache.rb', line 65 def count_records_with_detached_counters potential_table_name = [@owner.class.table_name, @reflection.klass.table_name, 'counts'].join('_') if (@owner.class.detached_counter_cache_table_names || []).include?(potential_table_name) DetachedCounterCache.count_from_connection( @owner.class.connection, potential_table_name, @reflection.foreign_key, @owner.id ) else count_records_without_detached_counters end end |