diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-01-13 17:28:31 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-01-13 17:28:31 -0500 |
commit | 173effd7a9b847d156a5548e29ae7df67798c7a2 (patch) | |
tree | a1f3181973a54051a6191c1b7067b547818d4680 /app/controllers | |
parent | 7e4b9ea0c23eb660ab36a6114a7a3046d8f1c5f6 (diff) | |
download | pokeviewer-173effd7a9b847d156a5548e29ae7df67798c7a2.tar.gz pokeviewer-173effd7a9b847d156a5548e29ae7df67798c7a2.tar.bz2 pokeviewer-173effd7a9b847d156a5548e29ae7df67798c7a2.zip |
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.
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/pokeviewer/pokemon_controller.rb | 7 |
1 files changed, 3 insertions, 4 deletions
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" | |||
3 | module Pokeviewer | 3 | module Pokeviewer |
4 | class PokemonController < ApplicationController | 4 | class PokemonController < ApplicationController |
5 | def index | 5 | def index |
6 | pokemon = Pokemon.joins(:revisions). | 6 | pokemon = Pokemon.joins(:current). |
7 | order("trainer_id IS NULL DESC"). | 7 | order("trainer_id IS NULL DESC"). |
8 | order(trainer_id: :asc). | 8 | order(trainer_id: :asc). |
9 | order(box: :asc). | 9 | order(box: :asc). |
10 | order(slot: :asc). | 10 | order(slot: :asc). |
11 | order("pokeviewer_revisions.sequential_id DESC"). | ||
12 | group("pokeviewer_pokemon.uuid"). | 11 | group("pokeviewer_pokemon.uuid"). |
13 | includes(:revisions). | 12 | includes(:current). |
14 | chunk do |p| | 13 | chunk do |p| |
15 | if p.trainer_id.nil? | 14 | if p.trainer_id.nil? |
16 | -1 | 15 | -1 |
@@ -70,7 +69,7 @@ module Pokeviewer | |||
70 | def show | 69 | def show |
71 | @pokemon = Pokemon.includes( | 70 | @pokemon = Pokemon.includes( |
72 | :trainer, :location, | 71 | :trainer, :location, |
73 | revisions: [:species, :item, :move_1, :move_2, :move_3, :move_4] | 72 | current: [:species, :item, :move_1, :move_2, :move_3, :move_4] |
74 | ).find_by_uuid! params[:id] | 73 | ).find_by_uuid! params[:id] |
75 | end | 74 | end |
76 | end | 75 | end |