diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-01-29 21:13:35 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-01-29 21:13:35 -0500 |
commit | 5ade37d852bd1e96f9451ab98619359a5a048cee (patch) | |
tree | 251c6bf7c24b7be69b2e908590a733a808165e4c /app/controllers | |
parent | 30cd66e1521bc760df45908adb2f7d3ba6683900 (diff) | |
download | pokeviewer-5ade37d852bd1e96f9451ab98619359a5a048cee.tar.gz pokeviewer-5ade37d852bd1e96f9451ab98619359a5a048cee.tar.bz2 pokeviewer-5ade37d852bd1e96f9451ab98619359a5a048cee.zip |
Added Pokédex viewing page
Currently a work in progress. The queries used to display the Pokémon for each species are very inefficient. The text at the top of the page is also very specific to the author.
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/pokeviewer/pokedex_controller.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/pokeviewer/pokedex_controller.rb b/app/controllers/pokeviewer/pokedex_controller.rb new file mode 100644 index 0000000..8286977 --- /dev/null +++ b/app/controllers/pokeviewer/pokedex_controller.rb | |||
@@ -0,0 +1,14 @@ | |||
1 | require_dependency "pokeviewer/application_controller" | ||
2 | |||
3 | module Pokeviewer | ||
4 | class PokedexController < ApplicationController | ||
5 | def index | ||
6 | @species = Species. | ||
7 | order(id: :asc). | ||
8 | includes(:pokedex_entries). | ||
9 | order("pokeviewer_pokedex_entries.trainer_id ASC") | ||
10 | |||
11 | @trainers = Trainer.order(id: :asc) | ||
12 | end | ||
13 | end | ||
14 | end | ||