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

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

Instance Method Summary collapse

Instance Method Details

#delete_records_with_record_cache(records, method) ⇒ Object



361
362
363
364
365
366
367
# File 'lib/record_cache/datastore/active_record_30.rb', line 361

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