Skip to content

Commit

Permalink
Avoid N+1 queries in comments controller
Browse files Browse the repository at this point in the history
According to metrics.opensuse.org the comments/index.xml.builder
view has the most impact - rendered 106K in 24 hours (all these
bots communicating through comments don't help)
  • Loading branch information
coolo committed Dec 19, 2018
1 parent be68942 commit 6fb2a24
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/app/controllers/comments_controller.rb
Expand Up @@ -2,7 +2,7 @@ class CommentsController < ApplicationController
before_action :find_obj, only: [:index, :create]

def index
@comments = @obj.comments.order(:id)
@comments = @obj.comments.includes(:user).order(:id)
end

def create
Expand Down

0 comments on commit 6fb2a24

Please sign in to comment.