diff --git a/lib/chewy/type/observe.rb b/lib/chewy/type/observe.rb index 492757203..47db0da02 100644 --- a/lib/chewy/type/observe.rb +++ b/lib/chewy/type/observe.rb @@ -9,14 +9,6 @@ def update_proc(type_name, *args, &block) method = args.first proc do - backreference = if method && method.to_s == 'self' - self - elsif method - send(method) - else - instance_eval(&block) - end - reference = if type_name.is_a?(Proc) if type_name.arity.zero? instance_exec(&type_name) @@ -27,7 +19,19 @@ def update_proc(type_name, *args, &block) type_name end - Chewy.derive_type(reference).update_index(backreference, options) + type = Chewy.derive_type(reference) + + next if Chewy.strategy.current.name == :bypass + + backreference = if method && method.to_s == 'self' + self + elsif method + send(method) + else + instance_eval(&block) + end + + type.update_index(backreference, options) end end