Module: Chewy::Index::Observe::ActiveRecordMethods

Defined in:
lib/chewy/index/observe.rb

Instance Method Summary collapse

Instance Method Details

#update_index(type_name, *args, &block) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/chewy/index/observe.rb', line 51

def update_index(type_name, *args, &block)
  callback_options = Observe.extract_callback_options!(args)
  update_proc = Observe.update_proc(type_name, *args, &block)

  if Chewy.use_after_commit_callbacks
    after_commit(**callback_options, &update_proc)
  else
    after_save(**callback_options, &update_proc)
    after_destroy(**callback_options, &update_proc)
  end
end