move recruited_by to separate view to avoid N+1
This commit is contained in:
parent
981feff814
commit
4224dcb257
1 changed files with 5 additions and 1 deletions
|
|
@ -63,8 +63,12 @@ module Api
|
|||
kamigame: c.kamigame
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# Separate view for recruitment info - only include when needed (e.g., character detail page)
|
||||
view :with_recruitment do
|
||||
include_view :full
|
||||
|
||||
# Reverse relationship: which weapon recruits this character
|
||||
field :recruited_by do |c|
|
||||
weapon = Weapon.find_by(recruits: c.granblue_id)
|
||||
next nil unless weapon
|
||||
|
|
|
|||
Loading…
Reference in a new issue