Sha256: ee339625195426aea752f967492be3eb239288a45128754a72f8a4b55cb2f2ec
Contents?: true
Size: 632 Bytes
Versions: 2
Compression:
Stored size: 632 Bytes
Contents
module Indexers module Concern extend ActiveSupport::Concern included do after_commit :index, on: :create after_commit :reindex, on: :update after_commit :unindex, on: :destroy end %i(index reindex unindex).each do |name| define_method name do self.class.indexer.send name, self end end module ClassMethods def search(*args) options = args.extract_options! Collection.new indexer, args, options end def indexer @indexer ||= Indexers.definitions.find(name.parameterize(separator: '_').to_sym) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
indexers-5.1.1 | lib/indexers/concern.rb |
indexers-5.1.0 | lib/indexers/concern.rb |