1
0
Fork 0

Fix N+1 on API

This commit is contained in:
Andrew Tomaka 2015-11-03 12:04:58 -05:00
parent 6910d6ae89
commit 183ca46fa4
1 changed files with 6 additions and 1 deletions

View File

@ -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