1 class VideoPolicyController < ApplicationController
4 # Make sure that a user logs in before doing any action here
5 before_filter :authorize, :only => [:index, :list, :show]
7 # Only managers can do the following actions
8 before_filter :manager, :only => [:new, :create, :edit, :update, :destroy]
12 render :action => 'list'
15 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
16 verify :method => :post, :only => [ :destroy, :create, :update ],
17 :redirect_to => { :action => :list }
20 @video_policy_pages, @video_policies = paginate :video_policies, :per_page => 10
24 @video_policy = VideoPolicy.find(params[:id])
28 @video_policy = VideoPolicy.new
32 @video_policy = VideoPolicy.new(params[:video_policy])
34 flash[:notice] = 'VideoPolicy was successfully created.'
35 redirect_to :action => 'list'
37 render :action => 'new'
42 @video_policy = VideoPolicy.find(params[:id])
46 @video_policy = VideoPolicy.find(params[:id])
47 if @video_policy.update_attributes(params[:video_policy])
48 flash[:notice] = 'VideoPolicy was successfully updated.'
49 redirect_to :action => 'show', :id => @video_policy
51 render :action => 'edit'
56 VideoPolicy.find(params[:id]).destroy
57 redirect_to :action => 'list'