From 8cd48234bffc13c1d1dd792b033f9eb738e95474 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Tue, 30 Jul 2019 20:26:52 -0700 Subject: [PATCH] Use class_name for inheritance --- lib/searchkick/bulk_indexer.rb | 4 ++-- lib/searchkick/model.rb | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/searchkick/bulk_indexer.rb b/lib/searchkick/bulk_indexer.rb index fc744ac..4da9505 100644 --- a/lib/searchkick/bulk_indexer.rb +++ b/lib/searchkick/bulk_indexer.rb @@ -61,7 +61,7 @@ module Searchkick if records.any? if async Searchkick::BulkReindexJob.perform_later( - class_name: records.first.model_name.name, + class_name: records.first.class.searchkick_options[:class_name], record_ids: records.map(&:id), index_name: index.name, method_name: method_name ? method_name.to_s : nil @@ -140,7 +140,7 @@ module Searchkick def bulk_reindex_job(scope, batch_id, options) Searchkick.with_redis { |r| r.sadd(batches_key, batch_id) } Searchkick::BulkReindexJob.perform_later({ - class_name: scope.model_name.name, + class_name: scope.searchkick_options[:class_name], index_name: index.name, batch_id: batch_id }.merge(options)) diff --git a/lib/searchkick/model.rb b/lib/searchkick/model.rb index 17ab288..df8af17 100644 --- a/lib/searchkick/model.rb +++ b/lib/searchkick/model.rb @@ -15,6 +15,7 @@ module Searchkick Searchkick.models << self options[:_type] ||= -> { searchkick_index.klass_document_type(self, true) } + options[:class_name] = model_name.name callbacks = options.key?(:callbacks) ? options[:callbacks] : :inline unless [:inline, true, false, :async, :queue].include?(callbacks) -- libgit2 0.21.0