1 class GameController < ApplicationController
4 render :action => 'list'
7 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
8 verify :method => :post, :only => [ :destroy, :create, :update ],
9 :redirect_to => { :action => :list }
12 @game_pages, @games = paginate :games, :per_page => 10
16 @game = Game.find(params[:id])
24 # A new rentable must be created whenever we create a new game
25 @rentable = Rentable.new
26 @rentable.rtype = 'game'
28 @game = Game.new(params[:game])
29 @game.rentable_id = @rentable.id
31 flash[:notice] = 'Game was successfully created.'
32 redirect_to :action => 'list'
34 render :action => 'new'
39 @game = Game.find(params[:id])
43 @game = Game.find(params[:id])
44 if @game.update_attributes(params[:game])
45 flash[:notice] = 'Game was successfully updated.'
46 redirect_to :action => 'show', :id => @game
48 render :action => 'edit'
53 Game.find(params[:id]).destroy
54 redirect_to :action => 'list'