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

Anonymous class triggers Only call searchkick once per model #1684

Closed
stevenou opened this issue Jul 2, 2024 · 1 comment
Closed

Anonymous class triggers Only call searchkick once per model #1684

stevenou opened this issue Jul 2, 2024 · 1 comment

Comments

@stevenou
Copy link

stevenou commented Jul 2, 2024

Not sure if this would be considered a bug or not.

I opened an issue with shoulda-matchers too: thoughtbot/shoulda-matchers#1639

Basically, they are now using Class.new to create an anonymous class of the original. I am running searchkick inside an abstract class' def inherited(subclass) method.

shoulda-matchers creating an anonymous class is triggering searchkick to run again on "the same model" thus raising this error.

Not sure if you would consider this a bug on shoulda-matchers, on searchkick, or perhaps poor implementation on my own codebase.

Input appreciated. Thanks!

@ankane
Copy link
Owner

ankane commented Jul 4, 2024

Hi @stevenou, it seems like it's due to inherited being called multiple times for the same subclass, so I don't think it's an issue with Searchkick.

@ankane ankane closed this as completed Jul 4, 2024
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

2 participants