Class: WorldDbAdmin::TagsController

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

Instance Method Summary collapse

Instance Method Details

#indexObject

GET /tags



8
9
10
11
# File 'app/controllers/world_db_admin/tags_controller.rb', line 8

def index
  ## fix: Tag.by_key   must be  key asc !! but is desc? why? fix it
  @tags = Tag.order('key asc').all
end

#shortcutObject

GET /tag/:key e.g. /tag/euro or /tag/north_america



14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/world_db_admin/tags_controller.rb', line 14

def shortcut
  @tag   = Tag.find_by_slug!( params[:key] )
  @order = params[:order] || 'title'

  ## magic parameter for dev -> generate yaml text template
  if params[:yml].present? || params[:yaml].present?
    render 'template.txt.erb', :layout => false, :content_type => 'text/plain'
    return
  end

  render :show
end

#showObject

GET /tags/:id e.g. /tags/1



28
29
30
# File 'app/controllers/world_db_admin/tags_controller.rb', line 28

def show
  @tag = Tag.find( params[:id] )
end