module Chewy::Index::Observe::ActiveRecordMethods
Public Instance Methods
initialize_chewy_callbacks()
click to toggle source
# File lib/chewy/index/observe/active_record_methods.rb, line 64 def initialize_chewy_callbacks if Chewy.use_after_commit_callbacks after_commit :update_chewy_indices, on: %i[create update] after_commit :run_chewy_callbacks, on: :destroy else after_save :update_chewy_indices after_destroy :run_chewy_callbacks end end
run_chewy_callbacks()
click to toggle source
# File lib/chewy/index/observe/active_record_methods.rb, line 51 def run_chewy_callbacks chewy_callbacks.each { |callback| callback.call(self) } end
update_chewy_indices()
click to toggle source
# File lib/chewy/index/observe/active_record_methods.rb, line 55 def update_chewy_indices Chewy.strategy.current.update_chewy_indices(self) end
update_index(type_name, *args, &block)
click to toggle source
# File lib/chewy/index/observe/active_record_methods.rb, line 74 def update_index(type_name, *args, &block) callback_options = Observe.extract_callback_options!(args) update_proc = Observe.update_proc(type_name, *args, &block) callback = Chewy::Index::Observe::Callback.new(update_proc, callback_options) initialize_chewy_callbacks if chewy_callbacks.empty? self.chewy_callbacks = chewy_callbacks.dup << callback end