Merge pull request #1409 from Retrospring/fix/no-eager-load-comments-smiles

This commit is contained in:
Karina Kwiatek 2023-10-23 07:53:58 +02:00 committed by GitHub
commit aaa5b605e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ class AnswerController < ApplicationController
turbo_stream_actions :pin, :unpin
def show
@answer = Answer.includes(comments: %i[user smiles], question: [:user], smiles: [:user]).find(params[:id])
@answer = Answer.includes(question: [:user], smiles: [:user]).find(params[:id])
@display_all = true
@subscribed_answer_ids = []

View File

@ -10,6 +10,6 @@ module User::AnswerMethods
answers
.order(:created_at)
.reverse_order
.includes(comments: %i[user smiles], question: { user: :profile }, smiles: [:user])
.includes(question: { user: [:profile] })
end
end

View File

@ -21,6 +21,6 @@ module User::TimelineMethods
.where("answers.user_id in (?) OR answers.user_id = ?", following_ids, id)
.order(:created_at)
.reverse_order
.includes(comments: %i[user smiles], question: { user: :profile }, user: [:profile], smiles: [:user])
.includes(question: { user: [:profile] }, user: [:profile])
end
end