Sha256: bc27383a46ceb58d9fbace5a04339a639c675db1d35fc9af6aba093b601c9c96

Contents?: true

Size: 475 Bytes

Versions: 2

Compression:

Stored size: 475 Bytes

Contents

module Cachers
  module Concern
    extend ActiveSupport::Concern

    included do
      %i(extend include).each do |action|
        send action, Delegation
      end
      after_commit :cache, on: :create
      after_commit :recache, on: :update
      after_commit :uncache, on: :destroy
    end

    def cacher
      @cacher ||= self.class.cacher.new(self)
    end

    module ClassMethods

      def cacher
        "#{name}Cacher".constantize
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cachers-5.1.2 lib/cachers/concern.rb
cachers-5.1.1 lib/cachers/concern.rb