Module: ElasticRecord::Callbacks
- Defined in:
- lib/elastic_record/callbacks.rb
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/elastic_record/callbacks.rb', line 3 def self.included(base) return unless base.respond_to?(:after_save) && base.respond_to?(:after_destroy) base.class_eval do after_create :index_to_elasticsearch after_update :update_index_document, if: -> { respond_to?(:saved_changes?) ? saved_changes? : changed? } after_destroy :delete_index_document end end |