From 7e4b9ea0c23eb660ab36a6114a7a3046d8f1c5f6 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 13 Jan 2018 16:01:51 -0500 Subject: Moved species from Pokémon to revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The migration will set all of the revisions of each Pokémon to have the species that that Pokémon was set to. If reversed, the migration sets the Pokémon's species to the first revision's species, which mimics the behavior of the engine from before this change, but do note that running the migration backwards like this can lose data. This change slightly affects the loading time of the front page. See #2. refs #3 --- app/controllers/pokeviewer/pokemon_controller.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/pokeviewer/pokemon_controller.rb b/app/controllers/pokeviewer/pokemon_controller.rb index 49a743c..7a1b9f9 100644 --- a/app/controllers/pokeviewer/pokemon_controller.rb +++ b/app/controllers/pokeviewer/pokemon_controller.rb @@ -10,9 +10,7 @@ module Pokeviewer order(slot: :asc). order("pokeviewer_revisions.sequential_id DESC"). group("pokeviewer_pokemon.uuid"). - select(:box, :slot, :uuid, :trainer_id, :species_id). - select(:ot_gender, :ot_name, :unown_letter). - select("pokeviewer_revisions.nickname AS nickname"). + includes(:revisions). chunk do |p| if p.trainer_id.nil? -1 @@ -71,8 +69,8 @@ module Pokeviewer def show @pokemon = Pokemon.includes( - :trainer, :species, :location, - revisions: [:item, :move_1, :move_2, :move_3, :move_4] + :trainer, :location, + revisions: [:species, :item, :move_1, :move_2, :move_3, :move_4] ).find_by_uuid! params[:id] end end -- cgit 1.4.1