ankane/searchkick

Anonymous class triggers `Only call searchkick once per model`

Closed this issue · 1 comments

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!

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.