Class: Ishapi::TagsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ishapi/tags_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#home, #long_term_token, #test

Instance Method Details

#indexObject



5
6
7
8
9
10
11
12
# File 'app/controllers/ishapi/tags_controller.rb', line 5

def index
  authorize! :index, Tag
  @tags = Tag.all
  if params[:domain]
    @site = Site.find_by( :domain => params[:domain], :lang => :en )
    @tags = @tags.where( :site => @site )
  end
end

#showObject



14
15
16
17
18
19
20
21
# File 'app/controllers/ishapi/tags_controller.rb', line 14

def show
  begin
    @tag = Tag.find_by( :name_seo => params[:tagname] )
  rescue Mongoid::Errors::DocumentNotFound
    @tag = Tag.find params[:tagname]
  end
  authorize! :show, @tag
end