Sha256: 7a6439ae6133f4f3a204f2d56519564a7833649608435010604e059d8b0d0f03

Contents?: true

Size: 536 Bytes

Versions: 26

Compression:

Stored size: 536 Bytes

Contents

module Spree
  module MemoizedData
    extend ActiveSupport::Concern

    included do
      # reset cache on save inside transaction and transaction commit
      after_save :reset_memoized_data
      after_commit :reset_memoized_data

      def reload(options = {})
        reset_memoized_data
        super(options)
      end

      private

      def reset_memoized_data
        self.class.const_get('MEMOIZED_METHODS').each do |v|
          instance_variable_set(:"@#{v.gsub(/\?/, '')}", nil)
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
spree_core-4.10.1 app/models/concerns/spree/memoized_data.rb
spree_core-4.10.0 app/models/concerns/spree/memoized_data.rb
spree_core-4.9.0 app/models/concerns/spree/memoized_data.rb
spree_core-4.8.3 app/models/concerns/spree/memoized_data.rb
spree_core-4.8.2 app/models/concerns/spree/memoized_data.rb
spree_core-4.7.3 app/models/concerns/spree/memoized_data.rb
spree_core-4.6.6 app/models/concerns/spree/memoized_data.rb
spree_core-4.5.5 app/models/concerns/spree/memoized_data.rb
spree_core-4.4.1 app/models/concerns/spree/memoized_data.rb
spree_core-4.5.4 app/models/concerns/spree/memoized_data.rb
spree_core-4.6.5 app/models/concerns/spree/memoized_data.rb
spree_core-4.7.2 app/models/concerns/spree/memoized_data.rb
spree_core-4.7.1 app/models/concerns/spree/memoized_data.rb
spree_core-4.6.4 app/models/concerns/spree/memoized_data.rb
spree_core-4.7.0 app/models/concerns/spree/memoized_data.rb
spree_core-4.6.3 app/models/concerns/spree/memoized_data.rb
spree_core-4.6.2 app/models/concerns/spree/memoized_data.rb
spree_core-4.6.1 app/models/concerns/spree/memoized_data.rb
spree_core-4.6.0 app/models/concerns/spree/memoized_data.rb
spree_core-4.5.3 app/models/concerns/spree/memoized_data.rb