fix N+1 queries in parties index
This commit is contained in:
parent
ef7c158736
commit
6f3f0d92ff
2 changed files with 3 additions and 3 deletions
|
|
@ -9,7 +9,7 @@ module PartyQueryingConcern
|
|||
Party.includes(
|
||||
{ raid: :group },
|
||||
:job,
|
||||
:user,
|
||||
{ user: { active_crew_membership: :crew } },
|
||||
:skill0,
|
||||
:skill1,
|
||||
:skill2,
|
||||
|
|
@ -18,7 +18,7 @@ module PartyQueryingConcern
|
|||
:guidebook2,
|
||||
:guidebook3,
|
||||
{ characters: :character },
|
||||
{ weapons: :weapon },
|
||||
{ weapons: { weapon: :weapon_series } },
|
||||
{ summons: :summon }
|
||||
)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ class Party < ApplicationRecord
|
|||
return false unless user
|
||||
|
||||
Rails.cache.fetch("party_#{id}_favorited_by_#{user.id}", expires_in: 1.hour) do
|
||||
user.favorite_parties.include?(self)
|
||||
Favorite.exists?(user_id: user.id, party_id: id)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue