Stop eager loading comments and smiles
This commit is contained in:
parent
e18abd3752
commit
65e802f51d
|
@ -8,7 +8,7 @@ class AnswerController < ApplicationController
|
||||||
turbo_stream_actions :pin, :unpin
|
turbo_stream_actions :pin, :unpin
|
||||||
|
|
||||||
def show
|
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
|
@display_all = true
|
||||||
@subscribed_answer_ids = []
|
@subscribed_answer_ids = []
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,6 @@ module User::AnswerMethods
|
||||||
answers
|
answers
|
||||||
.order(:created_at)
|
.order(:created_at)
|
||||||
.reverse_order
|
.reverse_order
|
||||||
.includes(comments: %i[user smiles], question: { user: :profile }, smiles: [:user])
|
.includes(question: { user: [:profile] })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,6 +21,6 @@ module User::TimelineMethods
|
||||||
.where("answers.user_id in (?) OR answers.user_id = ?", following_ids, id)
|
.where("answers.user_id in (?) OR answers.user_id = ?", following_ids, id)
|
||||||
.order(:created_at)
|
.order(:created_at)
|
||||||
.reverse_order
|
.reverse_order
|
||||||
.includes(comments: %i[user smiles], question: { user: :profile }, user: [:profile], smiles: [:user])
|
.includes(question: { user: [:profile] }, user: [:profile])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue