Class: Ishapi::VideosController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#test

Instance Method Details

#indexObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/ishapi/videos_controller.rb', line 10

def index
  authorize! :index, Video
  @videos = Video.all
  if params[:cityname]
    city = City.find_by :cityname => params[:cityname]
    @videos = @videos.where( :city_id => city.id )
  end
  if params[:domain]
    site = Site.find_by :domain => params[:domain], :lang => :en
    @videos = @videos.where( :site_id => site.id )
  end

  @videos = @videos.page( params[:videos_page] ).per( 10 )
end

#showObject



5
6
7
8
# File 'app/controllers/ishapi/videos_controller.rb', line 5

def show
  @video = Video.unscoped.find_by :name_seo => params[:name_seo]
  authorize! :show, @video
end