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
Thank's for this work! But i have a doubt, how to solve n+1 queries when render comments for post?
I try with include other models :
commentable.comments.includes(:user, :replies, :commentable).where(parent: nil)
in partial : _widget.html.erb
_widget.html.erb
but the render _comment.html.erb respond with :
_comment.html.erb
↳ app/views/comments/_widget.html.erb:3 Comment Load (0.4ms) SELECT "comments".* FROM "comments" WHERE "comments"."commentable_id" = $1 AND "comments"."commentable_type" = $2 AND "comments"."parent_id" IS NULL [["commentable_id", 27], ["commentable_type", "Post"]] ↳ app/views/comments/_widget.html.erb:7 User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 [["id", 24]] ↳ app/views/comments/_widget.html.erb:7 Comment Load (0.4ms) SELECT "comments".* FROM "comments" WHERE "comments"."parent_id" IN ($1, $2) [["parent_id", 11], ["parent_id", 8]] ↳ app/views/comments/_widget.html.erb:7 CACHE User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 24], ["LIMIT", 1]] ↳ app/views/comments/_comment.html.erb:8 Post Load (0.5ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = $1 ORDER BY "posts"."created_at" DESC LIMIT $2 [["id", 27], ["LIMIT", 1]] ↳ app/views/comments/_comment.html.erb:10 Comment Exists (0.4ms) SELECT 1 AS one FROM "comments" WHERE "comments"."parent_id" = $1 LIMIT $2 [["parent_id", 9], ["LIMIT", 1]] ↳ app/views/comments/_comment.html.erb:15 Comment Load (0.4ms) SELECT "comments".* FROM "comments" WHERE "comments"."parent_id" = $1 [["parent_id", 9]] ↳ app/views/comments/_comment.html.erb:17 CACHE User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 24], ["LIMIT", 1]] ↳ app/views/comments/_comment.html.erb:8 CACHE Post Load (0.0ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = $1 ORDER BY "posts"."created_at" DESC LIMIT $2 [["id", 27], ["LIMIT", 1]] ↳ app/views/comments/_comment.html.erb:10 Comment Exists (0.5ms) SELECT 1 AS one FROM "comments" WHERE "comments"."parent_id" = $1 LIMIT $2 [["parent_id", 10], ["LIMIT", 1]] ↳ app/views/comments/_comment.html.erb:15
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Thank's for this work!
But i have a doubt, how to solve n+1 queries when render comments for post?
I try with include other models :
in partial :
_widget.html.erb
but the render
_comment.html.erb
respond with :
The text was updated successfully, but these errors were encountered: