You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
box-o-sand/rails/map-mash/app/controllers/mash_tournaments_controller.rb

86 lines
2.3 KiB

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