diff --git a/lib/searchkick/model.rb b/lib/searchkick/model.rb index a86e84b..b4dbfcd 100644 --- a/lib/searchkick/model.rb +++ b/lib/searchkick/model.rb @@ -67,14 +67,16 @@ module Searchkick callbacks = options.key?(:callbacks) ? options[:callbacks] : true if callbacks if respond_to?(:after_commit) - after_commit :reindex, if: -> { Searchkick.callbacks? } + after_commit :reindex elsif respond_to?(:after_save) - after_save :reindex, if: -> { Searchkick.callbacks? } - after_destroy :reindex, if: -> { Searchkick.callbacks? } + after_save :reindex + after_destroy :reindex end end def reindex(method_name = nil, refresh: false, mode: nil) + return unless Searchkick.callbacks? + klass_options = self.class.searchkick_index.options if mode.nil? -- libgit2 0.21.0