module Elasticsearch::Model::Adapter::ActiveRecord::Callbacks
Public Class Methods
included(base)
click to toggle source
Handle index updates (creating, updating or deleting documents) when the model changes, by hooking into the lifecycle
@see guides.rubyonrails.org/active_record_callbacks.html
# File lib/elasticsearch/model/adapters/active_record.rb, line 80 def self.included(base) base.class_eval do after_commit lambda { __elasticsearch__.index_document }, on: :create after_commit lambda { __elasticsearch__.update_document }, on: :update after_commit lambda { __elasticsearch__.delete_document }, on: :destroy end end