Class: BeerDbAdmin::BeersController
- Inherits:
-
BeerDbAdminController
- Object
- ActionController::Base
- BeerDbAdminController
- BeerDbAdmin::BeersController
- Defined in:
- app/controllers/beer_db_admin/beers_controller.rb
Instance Method Summary collapse
- #index ⇒ Object
-
#shortcut ⇒ Object
GET /beer/:key e.g /beer/guiness /beer/ottakringerhelles.
-
#show ⇒ Object
GET /beers/:id e.g.
Instance Method Details
#index ⇒ Object
7 8 9 10 |
# File 'app/controllers/beer_db_admin/beers_controller.rb', line 7 def index # note: show 25 per page for now @beers = Beer.limit( 25 ).where( 'brewery_id is not null' ) end |
#shortcut ⇒ Object
GET /beer/:key e.g /beer/guiness /beer/ottakringerhelles
18 19 20 21 |
# File 'app/controllers/beer_db_admin/beers_controller.rb', line 18 def shortcut @beer = Beer.find_by_key!( params[:key] ) render :show end |
#show ⇒ Object
GET /beers/:id e.g. /beers/1
13 14 15 |
# File 'app/controllers/beer_db_admin/beers_controller.rb', line 13 def show @beer = Beer.find( params[:id] ) end |