Module: RecordCache::ActiveRecord::HasMany::InstanceMethods

Defined in:
lib/record_cache/datastore/active_record_30.rb,
lib/record_cache/datastore/active_record_31.rb

Instance Method Summary collapse

Instance Method Details

#delete_records_with_record_cache(records, method) ⇒ Object



305
306
307
308
309
310
311
# File 'lib/record_cache/datastore/active_record_30.rb', line 305

def delete_records_with_record_cache(records)
  # invalidate :id cache for all records
  records.each{ |record| record.class.record_cache.invalidate(record.id) if record.class.record_cache? unless record.new_record? }
  # invalidate the referenced class for the attribute/value pair on the index cache
  @reflection.klass.record_cache.invalidate(@reflection.primary_key_name.to_sym, @owner.id) if @reflection.klass.record_cache?
  delete_records_without_record_cache(records)
end