Modifying the mash tournament schema a touch and adding a slew of scaffold-y stuff

This commit is contained in:
Dan Buch
2012-03-09 08:11:54 -05:00
parent d4dda1e9d8
commit 1fa4ffbe65
19 changed files with 399 additions and 245 deletions

View File

@@ -0,0 +1,85 @@
class MashTournamentsController < ApplicationController
# GET /mash_tournaments
# GET /mash_tournaments.xml
def index
@mash_tournaments = MashTournament.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @mash_tournaments }
end
end
# GET /mash_tournaments/1
# GET /mash_tournaments/1.xml
def show
@mash_tournament = MashTournament.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @mash_tournament }
end
end
# GET /mash_tournaments/new
# GET /mash_tournaments/new.xml
def new
@mash_tournament = MashTournament.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @mash_tournament }
end
end
# GET /mash_tournaments/1/edit
def edit
@mash_tournament = MashTournament.find(params[:id])
end
# POST /mash_tournaments
# POST /mash_tournaments.xml
def create
@mash_tournament = MashTournament.new(params[:mash_tournament])
respond_to do |format|
if @mash_tournament.save
flash[:notice] = 'MashTournament was successfully created.'
format.html { redirect_to(@mash_tournament) }
format.xml { render :xml => @mash_tournament, :status => :created, :location => @mash_tournament }
else
format.html { render :action => "new" }
format.xml { render :xml => @mash_tournament.errors, :status => :unprocessable_entity }
end
end
end
# PUT /mash_tournaments/1
# PUT /mash_tournaments/1.xml
def update
@mash_tournament = MashTournament.find(params[:id])
respond_to do |format|
if @mash_tournament.update_attributes(params[:mash_tournament])
flash[:notice] = 'MashTournament was successfully updated.'
format.html { redirect_to(@mash_tournament) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @mash_tournament.errors, :status => :unprocessable_entity }
end
end
end
# DELETE /mash_tournaments/1
# DELETE /mash_tournaments/1.xml
def destroy
@mash_tournament = MashTournament.find(params[:id])
@mash_tournament.destroy
respond_to do |format|
format.html { redirect_to(mash_tournaments_url) }
format.xml { head :ok }
end
end
end