module Elasticsearch::Model::Adapter::JsonApiResource::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/adapter/json_api_resource.rb, line 33 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