Skip to content

Instantly share code, notes, and snippets.

@gabewb
Created September 17, 2010 03:13
Show Gist options
  • Save gabewb/583596 to your computer and use it in GitHub Desktop.
Save gabewb/583596 to your computer and use it in GitHub Desktop.
class GameController < ApplicationController
def list
@games = Game.find(:all)
end
def show
@game = Game.find(params[:id])
end
def new
@game = Game.new
@tags = Tag.find(:all)
end
def create
@game = Game.new(params[:game])
if @game.save
redirect_to :action => 'list'
else
@tags = Tag.find(:all)
puts('cow')
render :action => 'new'
end
end
def edit
@game = Game.find(params[:id])
@tags = Tag.find(:all)
end
def update
@game = Game.find(params[:id])
if @game.update_attributes(params[:game])
redirect_to :action => 'show', :id => @game
else
@Tags = Tag.find(:all)
render :action => 'edit'
end
end
def delete
Game.find(params[:id]).destroy
redirect_to :action => 'list'
end
def show_tags
@tag = Tag.find(params[:id])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment