1 class GamePolicyController < ApplicationController
3 # Make sure that the user has logged in before they can take any action
4 before_filter :authorize, :only => [:index, :list, :show]
6 # Make sure the user is a manager if they want to modify data
7 before_filter :manager, :only => [:new, :create, :edit, :update, :destroy]
11 render :action => 'list'
14 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
15 verify :method => :post, :only => [ :destroy, :create, :update ],
16 :redirect_to => { :action => :list }
19 @game_policy_pages, @game_policies = paginate :game_policies, :per_page => 10
23 @game_policy = GamePolicy.find(params[:id])
27 @game_policy = GamePolicy.new
31 @game_policy = GamePolicy.new(params[:game_policy])
33 flash[:notice] = 'GamePolicy was successfully created.'
34 redirect_to :action => 'list'
36 render :action => 'new'
41 @game_policy = GamePolicy.find(params[:id])
45 @game_policy = GamePolicy.find(params[:id])
46 if @game_policy.update_attributes(params[:game_policy])
47 flash[:notice] = 'GamePolicy was successfully updated.'
48 redirect_to :action => 'show', :id => @game_policy
50 render :action => 'edit'
55 GamePolicy.find(params[:id]).destroy
56 redirect_to :action => 'list'