From 803837fdb32abce240474413e78596d24582e7e7 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Wed, 4 Nov 2015 11:56:26 -0500 Subject: [PATCH] Default scope sucks, fix ordering for cards --- app/controllers/api/v1/cards_controller.rb | 2 +- app/models/card.rb | 2 -- app/views/admin/cards/index.html.slim | 2 ++ 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/v1/cards_controller.rb b/app/controllers/api/v1/cards_controller.rb index 7b04385..8fc255e 100644 --- a/app/controllers/api/v1/cards_controller.rb +++ b/app/controllers/api/v1/cards_controller.rb @@ -4,7 +4,7 @@ class Api::V1::CardsController < Api::V1::BaseController @cards = Card.includes(:character, :rarity, :type, :leader_skill, :passive_skill, :super_attack, :awaken_type, :dokkan_card, :hp_stat, :atk_stat, :def_stat, - :links) + :links).all.order(:gameid) render json: @cards, root: false end diff --git a/app/models/card.rb b/app/models/card.rb index d876c43..2e4cdcf 100644 --- a/app/models/card.rb +++ b/app/models/card.rb @@ -35,8 +35,6 @@ class Card < ActiveRecord::Base validates :type, presence: true validates :awaken_type, presence: true - default_scope { order(:gameid) } - scope :new_this_week, -> { where('created_at > ?', 1.week.ago) } def dokkan? diff --git a/app/views/admin/cards/index.html.slim b/app/views/admin/cards/index.html.slim index 762086f..aab425a 100644 --- a/app/views/admin/cards/index.html.slim +++ b/app/views/admin/cards/index.html.slim @@ -11,12 +11,14 @@ tr th Name th Title + th Updated th Actions tbody - @cards.each do |card| tr td= card.name td= card.title + td= card.updated_at td - if policy(:card).edit? = link_to glyph('edit', classes: 'control-icon'), edit_admin_card_path(card)