Sha256: 9f0b0256bc97e8fe7f6018cf1b43549a7d55c59b0dad585cbbfca8c156efdfc5
Contents?: true
Size: 1.84 KB
Versions: 1
Compression:
Stored size: 1.84 KB
Contents
class SportsController < ApplicationController # GET /sports # GET /sports.json def index @sports = Sport.all respond_to do |format| format.html # index.html.erb format.json { render json: @sports } end end # GET /sports/1 # GET /sports/1.json def show @sport = Sport.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @sport } end end # GET /sports/new # GET /sports/new.json def new @sport = Sport.new respond_to do |format| format.html # new.html.erb format.json { render json: @sport } end end # GET /sports/1/edit def edit @sport = Sport.find(params[:id]) end # POST /sports # POST /sports.json def create @sport = Sport.new(params[:sport]) respond_to do |format| if @sport.save format.html { redirect_to @sport, notice: 'Sport was successfully created.' } format.json { render json: @sport, status: :created, location: @sport } else format.html { render action: "new" } format.json { render json: @sport.errors, status: :unprocessable_entity } end end end # PUT /sports/1 # PUT /sports/1.json def update @sport = Sport.find(params[:id]) respond_to do |format| if @sport.update_attributes(params[:sport]) format.html { redirect_to @sport, notice: 'Sport was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @sport.errors, status: :unprocessable_entity } end end end # DELETE /sports/1 # DELETE /sports/1.json def destroy @sport = Sport.find(params[:id]) @sport.destroy respond_to do |format| format.html { redirect_to sports_url } format.json { head :ok } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
routespec-0.0.1 | test/rails311/app/controllers/sports_controller.rb |