From 65e802f51d8a3c18798ca884ea285356122fe21e Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Sun, 22 Oct 2023 21:51:21 +0200 Subject: [PATCH] Stop eager loading comments and smiles --- app/controllers/answer_controller.rb | 2 +- app/models/user/answer_methods.rb | 2 +- app/models/user/timeline_methods.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/answer_controller.rb b/app/controllers/answer_controller.rb index 2a6e5625..1b3a7ca3 100644 --- a/app/controllers/answer_controller.rb +++ b/app/controllers/answer_controller.rb @@ -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 = [] diff --git a/app/models/user/answer_methods.rb b/app/models/user/answer_methods.rb index e40eb82b..74e1a44e 100644 --- a/app/models/user/answer_methods.rb +++ b/app/models/user/answer_methods.rb @@ -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 diff --git a/app/models/user/timeline_methods.rb b/app/models/user/timeline_methods.rb index 822f9d8f..79da93d3 100644 --- a/app/models/user/timeline_methods.rb +++ b/app/models/user/timeline_methods.rb @@ -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