1 class VideoController < ApplicationController
4 # Make sure that a user logs in before doing any action here
5 before_filter :authorize, :except => :login
8 render :action => 'index'
11 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
12 verify :method => :post, :only => [ :destroy, :create, :update ],
13 :redirect_to => { :action => :list }
16 @video_pages, @videos = paginate :videos, :per_page => 10
20 @video = Video.find(params[:id])
28 @video = Video.new(params[:video])
30 flash[:notice] = 'Video was successfully created.'
31 redirect_to :action => 'list'
33 render :action => 'new'
38 @video = Video.find(params[:id])
42 @video = Video.find(params[:id])
43 if @video.update_attributes(params[:video])
44 flash[:notice] = 'Video was successfully updated.'
45 redirect_to :action => 'show', :id => @video
47 render :action => 'edit'
52 Video.find(params[:id]).destroy
53 redirect_to :action => 'list'
59 @videos = Video.find(:all, :conditions => ["title like ?", @query[0]+"%"])
60 render :action => 'searchresults'
62 render :action => 'search'