Class: BeerDbAdmin::RegionsController
- Inherits:
-
BeerDbAdminController
- Object
- ActionController::Base
- BeerDbAdminController
- BeerDbAdmin::RegionsController
- Defined in:
- app/controllers/beer_db_admin/regions_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
7 8 9 |
# File 'app/controllers/beer_db_admin/regions_controller.rb', line 7 def index @regions = Region.all end |
#shortcut ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/beer_db_admin/regions_controller.rb', line 15 def shortcut # todo/fix: check case if no key match; no country; no region etc. # split key into country key and region key if params[:key] =~ /([a-z]{2,3})[\-+.]([a-z]{1,3})/ @country = Country.find_by_key( $1 ) @region = Region.find_by_country_id_and_key( @country.id, $2 ) end render :show end |
#show ⇒ Object
11 12 13 |
# File 'app/controllers/beer_db_admin/regions_controller.rb', line 11 def show @region = Region.find( params[:id] ) end |