module Chewy::Index::Observe::ActiveRecordMethods

Public Instance Methods

update_index(type_name, *args, &block) click to toggle source
# 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