From 173effd7a9b847d156a5548e29ae7df67798c7a2 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 13 Jan 2018 17:28:31 -0500 Subject: Fixed incorrect icon eager loading bug on front page A bug was causing a Vigoroth which had evolved into a Slaking to still show up as a Vigoroth on the front page of the engine, even though it showed up properly on its show page. This was deemed to be caused by eager loading. --- app/controllers/pokeviewer/pokemon_controller.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/pokeviewer/pokemon_controller.rb b/app/controllers/pokeviewer/pokemon_controller.rb index 7a1b9f9..86b0ea6 100644 --- a/app/controllers/pokeviewer/pokemon_controller.rb +++ b/app/controllers/pokeviewer/pokemon_controller.rb @@ -3,14 +3,13 @@ require_dependency "pokeviewer/application_controller" module Pokeviewer class PokemonController < ApplicationController def index - pokemon = Pokemon.joins(:revisions). + pokemon = Pokemon.joins(:current). order("trainer_id IS NULL DESC"). order(trainer_id: :asc). order(box: :asc). order(slot: :asc). - order("pokeviewer_revisions.sequential_id DESC"). group("pokeviewer_pokemon.uuid"). - includes(:revisions). + includes(:current). chunk do |p| if p.trainer_id.nil? -1 @@ -70,7 +69,7 @@ module Pokeviewer def show @pokemon = Pokemon.includes( :trainer, :location, - revisions: [:species, :item, :move_1, :move_2, :move_3, :move_4] + current: [:species, :item, :move_1, :move_2, :move_3, :move_4] ).find_by_uuid! params[:id] end end -- cgit 1.4.1