Sha256: 6862a0a84e069982500046ecff9b8513d59498b5abab543901d6be4c629e7180
Contents?: true
Size: 749 Bytes
Versions: 1
Compression:
Stored size: 749 Bytes
Contents
# frozen_string_literal: true module SecondLevelCache module ActiveRecord module Associations module BelongsToAssociation def find_target return super unless klass.second_level_cache_enabled? cache_record = klass.read_second_level_cache(second_level_cache_key) if cache_record return cache_record.tap { |record| set_inverse_instance(record) } end record = super return nil unless record record.tap do |r| set_inverse_instance(r) r.write_second_level_cache end end private def second_level_cache_key owner[reflection.foreign_key] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
second_level_cache-2.6.1 | lib/second_level_cache/active_record/belongs_to_association.rb |