Sha256: 87cff19e56283e7f3f8a8a0a4cd15b817a5b2a0dec991aab2be1c89d396ad46a

Contents?: true

Size: 876 Bytes

Versions: 2

Compression:

Stored size: 876 Bytes

Contents

# encoding: utf-8

module BeerDbAdmin

class CountriesController < BeerDbAdminController
  
  def index
    @countries = Country.all
  end

  # GET /:key  e.g  /at or /us etc.
  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

  # GET /countries/:id  e.g. /countries/1
  def show
    @country = Country.find( params[:id] )
  end


end # class CountriesController

end # module BeerDbAdmin

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
beerdb-admin-0.1.0 app/controllers/beer_db_admin/countries_controller.rb
beerdb-admin-0.0.1 app/controllers/beer_db_admin/countries_controller.rb