diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/pokeviewer/pokemon_controller.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/app/controllers/pokeviewer/pokemon_controller.rb b/app/controllers/pokeviewer/pokemon_controller.rb index 7045807..2c38e56 100644 --- a/app/controllers/pokeviewer/pokemon_controller.rb +++ b/app/controllers/pokeviewer/pokemon_controller.rb | |||
@@ -70,6 +70,21 @@ module Pokeviewer | |||
70 | def show | 70 | def show |
71 | end | 71 | end |
72 | 72 | ||
73 | def show_revision | ||
74 | @revision = Revision. | ||
75 | where( | ||
76 | sequential_id: params[:revision_id], | ||
77 | pokeviewer_pokemon: { uuid: params[:id] } | ||
78 | ).includes( | ||
79 | :species, :item, :move_1, :move_2, :move_3, :move_4, | ||
80 | pokemon: [:trainer, :location] | ||
81 | ).first | ||
82 | |||
83 | @pokemon = @revision.pokemon | ||
84 | |||
85 | render :show | ||
86 | end | ||
87 | |||
73 | def embed | 88 | def embed |
74 | render layout: false | 89 | render layout: false |
75 | end | 90 | end |
@@ -77,9 +92,12 @@ module Pokeviewer | |||
77 | protected | 92 | protected |
78 | def load_pokemon | 93 | def load_pokemon |
79 | @pokemon = Pokemon.includes( | 94 | @pokemon = Pokemon.includes( |
80 | :trainer, :location, | 95 | current: [ |
81 | current: [:species, :item, :move_1, :move_2, :move_3, :move_4] | 96 | :species, :item, :move_1, :move_2, :move_3, :move_4, |
97 | pokemon: [:trainer, :location]] | ||
82 | ).find_by_uuid! params[:id] | 98 | ).find_by_uuid! params[:id] |
99 | |||
100 | @revision = @pokemon.current | ||
83 | end | 101 | end |
84 | end | 102 | end |
85 | end | 103 | end |