You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[MODEL] Added Elasticsearch::Model::Callbacks module to automatically update the index by using model callbacks
The behaviour is opt-in -- you have to include the module so the callbacks are registered.
Example:
class Article < ActiveRecord::Base
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
end
Article.create title: 'New Record'
(0.3ms) begin transaction
SQL (0.3ms) INSERT INTO "articles" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", 2013-11-12 18:21:15 UTC], ["title", "New Record"], ["updated_at", 2013-11-12 18:21:15 UTC]]
(0.1ms) commit transaction
2013-11-12 19:21:15 +0100: PUT http://localhost:9200/articles/article/4 [status:201, request:0.005s, query:n/a]
2013-11-12 19:21:15 +0100: > {"id":4,"title":"New Record","published_at":null,"created_at":"2013-11-12T18:21:15Z","updated_at":"2013-11-12T18:21:15Z"}
2013-11-12 19:21:15 +0100: < {"ok":true,"_index":"articles","_type":"article","_id":"4","_version":1}
# => #<Article id: 4, title: "New Record", published_at: nil, created_at: "2013-11-12 18:21:15", updated_at: "2013-11-12 18:21:15">
0 commit comments