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 @game = Game.new(params[:game])
26 flash[:notice] = 'Game was successfully created.'
27 redirect_to :action => 'list'
29 render :action => 'new'
34 @game = Game.find(params[:id])
38 @game = Game.find(params[:id])
39 if @game.update_attributes(params[:game])
40 flash[:notice] = 'Game was successfully updated.'
41 redirect_to :action => 'show', :id => @game
43 render :action => 'edit'
48 Game.find(params[:id]).destroy
49 redirect_to :action => 'list'
53 render :action => 'searchbyname'
58 @games = Game.find(:all, :conditions => ["title like ?", query[0]+"%"])