-
Notifications
You must be signed in to change notification settings - Fork 792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Callbacks when updating associated record? #57
Comments
To clarify, is it possible to hit the callback method using |
To further clarify, I have a model
Is there another method to reindex after touch that I'm not seeing? |
Depends on how you define the associations -- have a look e.g. here: https://github.com/elasticsearch/elasticsearch-rails/blob/master/elasticsearch-model/examples/activerecord_associations.rb |
Aye, this was missing, see this: e8a7f49 |
Ah ok so |
Ok, what if an In that case if you had |
@bcackerman So what happens when you try it out? |
Specifically I have an index like this:
Where an |
@bcackerman Have you actually tried your suggestion? Why are you asking me what happens? |
Oh, I am trying it :) I'm just letting you know it doesn't seem that the Callbacks class works to reindex the record when there's an |
Figured it out, thanks! |
…serialized during update Previously, the `update_document` method simply intercepted the changes to the model, via the `@__changed_attributes` variable, and used these directly. This caused models with a custom serialization method to be incorrectly serialized, namely unwanted attributes were added. This patch looks for `as_indexed_json` defined on the model, and when it finds it, filters the changed attributes through the keys. Closes #75 Related: * #59 * #57 * #52 * #40 * #37 * #5
To follow up on this, associated records that the updated record |
So in your example
https://github.com/elasticsearch/elasticsearch-rails/blob/templates/elasticsearch-rails/lib/rails/templates/searchable.rb#L60
ifAuthors
is updated, how would the original model's index get updated? Running into this issue locally.The text was updated successfully, but these errors were encountered: