Sha256: 876cd9636504afe55d95843c91f05941a55916e1ee8aa528dfc2591a4d133b27

Contents?: true

Size: 423 Bytes

Versions: 1

Compression:

Stored size: 423 Bytes

Contents

require 'active_support/concern'

module ChewyKiqqer
  module Mixin

    extend ActiveSupport::Concern

    module ClassMethods

      attr_reader :index_name

      def async_update_index(index_name)
        @index_name = index_name
        after_save    :queue_job
        after_destroy :queue_job
      end

    end

    def queue_job
      ChewyKiqqer::Worker.perform_async(self.class.index_name, id)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chewy_kiqqer-0.0.1 lib/chewy_kiqqer/mixin.rb