Fix N+1 on API
This commit is contained in:
parent
6910d6ae89
commit
183ca46fa4
1 changed files with 6 additions and 1 deletions
|
@ -1,7 +1,12 @@
|
|||
class Api::V1::CardsController < Api::V1::BaseController
|
||||
before_action :set_card, only: [:show]
|
||||
def index
|
||||
render json: Card.all, root: false
|
||||
@cards = Card.includes(:character, :rarity, :type, :leader_skill,
|
||||
:passive_skill, :super_attack, :awaken_type,
|
||||
:dokkan_card, :hp_stat, :atk_stat, :def_stat,
|
||||
:links)
|
||||
|
||||
render json: @cards, root: false
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
Loading…
Reference in a new issue