1 class GamePolicyController < ApplicationController
4 # Make sure that the user has logged in before they can take any action
5 before_filter :authorize, :only => [:index, :list, :show]
7 # Make sure the user is a manager if they want to modify data
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 @game_policy_pages, @game_policies = paginate :game_policies, :per_page => 10
24 @game_policy = GamePolicy.find(params[:id])
28 @game_policy = GamePolicy.new
32 @game_policy = GamePolicy.new(params[:game_policy])
34 flash[:notice] = 'GamePolicy was successfully created.'
35 redirect_to :action => 'list'
37 render :action => 'new'
42 @game_policy = GamePolicy.find(params[:id])
46 @game_policy = GamePolicy.find(params[:id])
47 if @game_policy.update_attributes(params[:game_policy])
48 flash[:notice] = 'GamePolicy was successfully updated.'
49 redirect_to :action => 'show', :id => @game_policy
51 render :action => 'edit'
56 GamePolicy.find(params[:id]).destroy
57 redirect_to :action => 'list'