Commit ed7a137f23bb320faecb9a4b4ab49045c7bd0df0
1 parent
e1e4ea6d
Exists in
master
and in
19 other branches
Don't allow any updates in Searchkick.callbacks(false) block [skip ci]
Showing
1 changed file
with
5 additions
and
3 deletions
Show diff stats
lib/searchkick/model.rb
... | ... | @@ -67,14 +67,16 @@ module Searchkick |
67 | 67 | callbacks = options.key?(:callbacks) ? options[:callbacks] : true |
68 | 68 | if callbacks |
69 | 69 | if respond_to?(:after_commit) |
70 | - after_commit :reindex, if: -> { Searchkick.callbacks? } | |
70 | + after_commit :reindex | |
71 | 71 | elsif respond_to?(:after_save) |
72 | - after_save :reindex, if: -> { Searchkick.callbacks? } | |
73 | - after_destroy :reindex, if: -> { Searchkick.callbacks? } | |
72 | + after_save :reindex | |
73 | + after_destroy :reindex | |
74 | 74 | end |
75 | 75 | end |
76 | 76 | |
77 | 77 | def reindex(method_name = nil, refresh: false, mode: nil) |
78 | + return unless Searchkick.callbacks? | |
79 | + | |
78 | 80 | klass_options = self.class.searchkick_index.options |
79 | 81 | |
80 | 82 | if mode.nil? | ... | ... |