Commit 8cd48234bffc13c1d1dd792b033f9eb738e95474

Authored by Andrew Kane
1 parent f94568d7

Use class_name for inheritance

lib/searchkick/bulk_indexer.rb
... ... @@ -61,7 +61,7 @@ module Searchkick
61 61 if records.any?
62 62 if async
63 63 Searchkick::BulkReindexJob.perform_later(
64   - class_name: records.first.model_name.name,
  64 + class_name: records.first.class.searchkick_options[:class_name],
65 65 record_ids: records.map(&:id),
66 66 index_name: index.name,
67 67 method_name: method_name ? method_name.to_s : nil
... ... @@ -140,7 +140,7 @@ module Searchkick
140 140 def bulk_reindex_job(scope, batch_id, options)
141 141 Searchkick.with_redis { |r| r.sadd(batches_key, batch_id) }
142 142 Searchkick::BulkReindexJob.perform_later({
143   - class_name: scope.model_name.name,
  143 + class_name: scope.searchkick_options[:class_name],
144 144 index_name: index.name,
145 145 batch_id: batch_id
146 146 }.merge(options))
... ...
lib/searchkick/model.rb
... ... @@ -15,6 +15,7 @@ module Searchkick
15 15 Searchkick.models << self
16 16  
17 17 options[:_type] ||= -> { searchkick_index.klass_document_type(self, true) }
  18 + options[:class_name] = model_name.name
18 19  
19 20 callbacks = options.key?(:callbacks) ? options[:callbacks] : :inline
20 21 unless [:inline, true, false, :async, :queue].include?(callbacks)
... ...