Class: WorldDbAdmin::CitiesController

Inherits:
WorldDbAdminController show all
Defined in:
app/controllers/world_db_admin/cities_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject

GET /cities



8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/world_db_admin/cities_controller.rb', line 8

def index
  
  order = params[:order]
  @cities = case order
      when 'pop'   then  City.by_pop.all
      when 'popm'  then  City.order( 'popm desc' ).all
      when 'title' then  City.by_title.all
      else               City.by_key.all
  end
  
end

#shortcutObject

GET /:key



21
22
23
24
# File 'app/controllers/world_db_admin/cities_controller.rb', line 21

def shortcut
  ## for now just redirect to cities page w/ anchor includes e.g cities/#newyork
  redirect_to cities_path( :anchor => params[:key] )
end