Module: RecordCache::ActiveRecord::HasOne::InstanceMethods

Defined in:
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_with_record_cache(method = ) ⇒ Object



413
414
415
416
417
418
419
420
421
# File 'lib/record_cache/datastore/active_record_31.rb', line 413

def delete_with_record_cache(method = options[:dependent])
  # invalidate :id cache for all record
  if load_target
    target.class.record_cache.invalidate(target.id) if target.class.record_cache? unless target.new_record?
  end
  # invalidate the referenced class for the attribute/value pair on the index cache
  @reflection.klass.record_cache.invalidate(@reflection.foreign_key.to_sym, @owner.id) if @reflection.klass.record_cache?
  delete_without_record_cache(method)
end