Created
September 17, 2010 03:13
-
-
Save gabewb/583596 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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