Sha256: 6ce95b30247a6ed667e590bd65a03c20483f0c53f80f0ee2f6f33390d464d217
Contents?: true
Size: 673 Bytes
Versions: 2
Compression:
Stored size: 673 Bytes
Contents
require 'active_support' module CachedCounts module ActiveRecordBaseMethods extend ActiveSupport::Concern included do after_save :clear_count_cache after_destroy :clear_count_cache class << self target = case Rails::VERSION::MAJOR when 3 :scoped when 4 :all end delegate :clear_count_cache, :count_with_caching, :length_with_caching, :size_with_caching, :count_without_caching, :length_without_caching, :size_without_caching, :to => target end private def clear_count_cache self.class.clear_count_cache end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cached_counts-0.3.0 | lib/cached_counts/active_record_base_methods.rb |
cached_counts-0.2.5 | lib/cached_counts/active_record_base_methods.rb |