Sha256: 89f6a97dbce11c9b1b06847c9b8e24bf6b45000e5ca20423c725e1141eecc15d
Contents?: true
Size: 430 Bytes
Versions: 32
Compression:
Stored size: 430 Bytes
Contents
module Spree class Tracker < Spree::Base after_commit :clear_cache validates :analytics_id, presence: true, uniqueness: { allow_blank: true } def self.current tracker = Rails.cache.fetch("current_tracker") do where(active: true).first end tracker.analytics_id.present? ? tracker : nil if tracker end def clear_cache Rails.cache.delete("current_tracker") end end end
Version data entries
32 entries across 32 versions & 1 rubygems