--- /dev/null
+class VideoPolicyController < ApplicationController
+ def index
+ list
+ render :action => 'list'
+ end
+
+ # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
+ verify :method => :post, :only => [ :destroy, :create, :update ],
+ :redirect_to => { :action => :list }
+
+ def list
+ @video_policy_pages, @video_policies = paginate :video_policies, :per_page => 10
+ end
+
+ def show
+ @video_policy = VideoPolicy.find(params[:id])
+ end
+
+ def new
+ @video_policy = VideoPolicy.new
+ end
+
+ def create
+ @video_policy = VideoPolicy.new(params[:video_policy])
+ if @video_policy.save
+ flash[:notice] = 'VideoPolicy was successfully created.'
+ redirect_to :action => 'list'
+ else
+ render :action => 'new'
+ end
+ end
+
+ def edit
+ @video_policy = VideoPolicy.find(params[:id])
+ end
+
+ def update
+ @video_policy = VideoPolicy.find(params[:id])
+ if @video_policy.update_attributes(params[:video_policy])
+ flash[:notice] = 'VideoPolicy was successfully updated.'
+ redirect_to :action => 'show', :id => @video_policy
+ else
+ render :action => 'edit'
+ end
+ end
+
+ def destroy
+ VideoPolicy.find(params[:id]).destroy
+ redirect_to :action => 'list'
+ end
+end