Module: ActiveRecord::CacheKeyCaching::AssociationCollectionExtension

Defined in:
lib/magic_cache_keys.rb

Instance Method Summary collapse

Instance Method Details

#cache_keyObject



6
7
8
9
10
11
12
13
14
# File 'lib/magic_cache_keys.rb', line 6

def cache_key
  key = @reflection.klass.cache_key(scope(:find))
  
  new_records_count = @target.select { |r| r.new_record? }.size

  key << "/#{new_records_count}new" if new_records_count > 0
  
  key
end