-
Notifications
You must be signed in to change notification settings - Fork 371
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
Trying to eager load searchable #53
Comments
I'm not sure I understand your use case. Why is it useful to eager load Dispatches, but not other searchables? |
I want to eager load searchables, but they are a polymorphic association, that can't be eager loaded with a simple |
According to the latest Rails documentation, eager loading is supported for polymorphic associations. I don't remember this feature being added to Rails, but if it works, that would be great! Search for "Eager loading is supported with polymorphic associations." on this page: So, does this work? PgSearch.multisearch("foo").includes(:searchable) |
Also, to clarify, |
I just tested it out, and it works! I'm going to close this for now. Please let me know if you run into any problems with it. |
Hi fellows,
I am experimenting with multi search, and I am trying to eager load searchable from the document search results.
My approach to open up the
Document
class and add a scopeThis is of course to bypass the polymorphic limitation for eager loading. Now I can write something like:
Do you think this is a desirable addition to this gem, shall I make a pull request?
Regards,
The text was updated successfully, but these errors were encountered: