Class: BeerDbAdmin::CountriesController
- Inherits:
-
BeerDbAdminController
- Object
- ActionController::Base
- BeerDbAdminController
- BeerDbAdmin::CountriesController
- Defined in:
- app/controllers/beer_db_admin/countries_controller.rb
Instance Method Summary collapse
- #index ⇒ Object
-
#shortcut ⇒ Object
GET /:key e.g /at or /us etc.
-
#show ⇒ Object
GET /countries/:id e.g.
Instance Method Details
#index ⇒ Object
7 8 9 |
# File 'app/controllers/beer_db_admin/countries_controller.rb', line 7 def index # list by continent end |
#shortcut ⇒ Object
GET /:key e.g /at or /us etc.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/beer_db_admin/countries_controller.rb', line 13 def shortcut order = params[:order] || 'title' if order == 'key' @order_clause = 'key' elsif order == 'hl' @order_clause = 'prod desc, title' elsif order == 'adr' @order_clause = 'address, title' else # by_title @order_clause = 'title' end @country = Country.find_by_key!( params[:key] ) style = params[:style] || 'std' if style == 'pocket' render :show_pocket else render :show end end |
#show ⇒ Object
GET /countries/:id e.g. /countries/1
39 40 41 |
# File 'app/controllers/beer_db_admin/countries_controller.rb', line 39 def show @country = Country.find( params[:id] ) end |