Created
August 1, 2008 13:36
-
-
Save radar/3623 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
# Add this line: | |
map.resources :teams |
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 TeamController < ApplicationController | |
def index | |
@teams = Team.find(:all) | |
end | |
def show | |
@team = Team.find(params[:id]) | |
end | |
def new | |
@team = Team.new | |
end | |
def create | |
@team = Team.new(params[:team]) | |
if @team.save | |
redirect_to teams_path | |
else | |
render :action => "new" | |
end | |
end | |
def edit | |
@team = Team.find(params[:id]) | |
end | |
def update | |
@team = Team.find(params[:id]) | |
if @team.update_attributes(params[:team]) | |
redirect_to team_path(@team) | |
else | |
render :action => "edit" | |
end | |
end | |
def destroy | |
Team.find(params[:id]).destroy | |
redirect_to teams_path | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment