diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2019-01-14 13:31:19 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2019-01-14 13:31:19 -0500 |
commit | 69c927c32774c1fbca315254ef0ff2b99138c21f (patch) | |
tree | 73d04f9cb9faa31d0258735a41b5867d6971bc17 /app/controllers | |
parent | f1d4da70ccb3d298cc7cf1cdcde2748048238dab (diff) | |
download | pokeviewer-69c927c32774c1fbca315254ef0ff2b99138c21f.tar.gz pokeviewer-69c927c32774c1fbca315254ef0ff2b99138c21f.tar.bz2 pokeviewer-69c927c32774c1fbca315254ef0ff2b99138c21f.zip |
Added revision permalinks
There are now URLs for each revision of a Pokémon. They are not linked to from anywhere yet. There are no embeds for them yet. refs #5
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 |