Skip to content
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

Detect changes in associations #74

Closed
chrisyeung1121 opened this issue Aug 12, 2015 · 5 comments
Closed

Detect changes in associations #74

chrisyeung1121 opened this issue Aug 12, 2015 · 5 comments

Comments

@chrisyeung1121
Copy link

In the nested object / assocation section,

I am wondering how to detect association changes and trigger reindex?

@redox
Copy link
Contributor

redox commented Aug 12, 2015

Hey @chrisyeung1121,

currently there is not automatic way to do that, you need to call the reindex! method of the parent object yourself. One solution could be to implement the after_touch issue.

Are you used to use the touch callbacks?

@chrisyeung1121
Copy link
Author

I have used somethings like

class Car
  belongs_to :user, touch: true
end

in which when cars get updated, the updated_at in user will change. but not the inverse.. I guess in this case I can have a after_touch call back in the User model. I wonder if I should use after_save or after_commit or after_touch though

@noahmatisoff
Copy link

+1

1 similar comment
@dodeja
Copy link

dodeja commented Nov 11, 2015

+1

@redox redox mentioned this issue Dec 1, 2016
Jerska added a commit that referenced this issue Jan 18, 2018
I was asked on support how to handle changes in nested children
and stumbled upon #40 and #74.
This PR aims to explain how to handle those.

I don't believe we'll have ever a way of detecting them, so:
Closes #74
@julienbourdeau
Copy link
Contributor

If I understand correctly this was documented some time ago: https://www.algolia.com/doc/framework-integration/rails/options/#nested-objectsrelations

I think I can close this issue. If I missed something, please let me know and I'll reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants