From 6f3957a0b2eb6224e757dcc10af9da0c12e47662 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Mon, 9 Nov 2015 12:49:57 -0500 Subject: [PATCH] Add type and rarity to card index --- app/controllers/admin/cards_controller.rb | 5 ++++- app/views/admin/cards/index.html.slim | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin/cards_controller.rb b/app/controllers/admin/cards_controller.rb index 33b7980..d96a0ee 100644 --- a/app/controllers/admin/cards_controller.rb +++ b/app/controllers/admin/cards_controller.rb @@ -3,7 +3,10 @@ class Admin::CardsController < Admin::BaseController after_action :verify_authorized def index - @cards = Card.includes(:character).all.order(updated_at: :desc) + @cards = Card + .includes(:character, :type, :rarity) + .all + .order(updated_at: :desc) authorize Card end diff --git a/app/views/admin/cards/index.html.slim b/app/views/admin/cards/index.html.slim index aab425a..285b7a6 100644 --- a/app/views/admin/cards/index.html.slim +++ b/app/views/admin/cards/index.html.slim @@ -11,14 +11,16 @@ tr th Name th Title - th Updated + th Type + th Rarity th Actions tbody - @cards.each do |card| tr td= card.name td= card.title - td= card.updated_at + td= card.type.name + td= card.rarity.name td - if policy(:card).edit? = link_to glyph('edit', classes: 'control-icon'), edit_admin_card_path(card)