From f89b21c253154ea09a91519d5a85cb5a37f8ba24 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 9 Feb 2025 18:12:56 -0800 Subject: [PATCH] Eager load raids/groups when querying --- app/controllers/api/v1/raids_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/raids_controller.rb b/app/controllers/api/v1/raids_controller.rb index c403288..c08326d 100644 --- a/app/controllers/api/v1/raids_controller.rb +++ b/app/controllers/api/v1/raids_controller.rb @@ -4,7 +4,7 @@ module Api module V1 class RaidsController < Api::V1::ApiController def all - render json: RaidBlueprint.render(Raid.all, view: :full) + render json: RaidBlueprint.render(Raid.includes(:group).all, view: :nested) end def show @@ -13,7 +13,7 @@ module Api end def groups - render json: RaidGroupBlueprint.render(RaidGroup.all, view: :full) + render json: RaidGroupBlueprint.render(RaidGroup.includes(raids: :group).all, view: :full) end end end