We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is there a way to avoid n+1 queries?
I have a class Company:
class Company < ActiveRecord::Base acts_as_followable end
And I make a query to get a certain type of companies, but I want to get the followers of each one of those and I end up with n+1 queries:
SELECT COUNT(*) FROM "follows" WHERE "follows"."followable_id" = $1 AND "follows"."followable_type" = $2 AND "follows"."blocked" = $3 [["followable_id", 419], ["followable_type", "Company"], ["blocked", "f"]]
The text was updated successfully, but these errors were encountered:
Anyone created a fork with optimized queries for this issue yet??
Sorry, something went wrong.
No branches or pull requests
Is there a way to avoid n+1 queries?
I have a class Company:
And I make a query to get a certain type of companies, but I want to get the followers of each one of those and I end up with n+1 queries:
SELECT COUNT(*) FROM "follows" WHERE "follows"."followable_id" = $1 AND "follows"."followable_type" = $2 AND "follows"."blocked" = $3 [["followable_id", 419], ["followable_type", "Company"], ["blocked", "f"]]
The text was updated successfully, but these errors were encountered: