Class: BeerDbAdmin::BeersController

Inherits:
BeerDbAdminController show all
Defined in:
app/controllers/beer_db_admin/beers_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



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

#shortcutObject

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

#showObject

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