examples/datamapper_article.rb in elasticsearch-model-5.1.0 vs examples/datamapper_article.rb in elasticsearch-model-6.0.0.pre

- old
+ new

@@ -48,13 +48,23 @@ # Implement the interface for fetching records # module Records def records - klass.all(id: @ids) + klass.all(id: ids) end # ... + end + + module Callbacks + def self.included(model) + model.class_eval do + after(:create) { __elasticsearch__.index_document } + after(:save) { __elasticsearch__.update_document } + after(:destroy) { __elasticsearch__.delete_document } + end + end end end # Register the adapter #