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
Question: how do I do eager loading? #251
Comments
This isn't the right place to ask about it, as it's totally unrelated to PublicActivity. Try Rails discussion groups or google for solutions, it's a common problem. quick googling suggests: |
I was looking for the same but couldn't quite figure it out (even after searching). Adding just |
.includes(:trackable) is correct, but I never found a way to eager load On Monday, February 22, 2016, Rutger Laurman notifications@github.com
|
Did anyone solve this problem ? include second level associations is not working for me neither ? |
Just came back on this topic after while, if someone needs help, here is something that worked for me: PublicActivity::Activity
.includes(:trackable)
.preload(trackable: [
users: {avatar_attachment: :blob},
...
]) Good luck ! |
I'd like to be able to do this:
But this isn't exactly possible like so, because
trackable
is polymorphic. I'll get errors like so:The text was updated successfully, but these errors were encountered: