Sha256: 5393c795e70a916430aeaf8262c5e311db4d36eb40b68278885241e81aeaac73
Contents?: true
Size: 1.92 KB
Versions: 2
Compression:
Stored size: 1.92 KB
Contents
class WidgetsController < ApplicationController # GET /widgets # GET /widgets.xml def index @widgets = Widget.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @widgets } end end # GET /widgets/1 # GET /widgets/1.xml def show @widget = Widget.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @widget } end end # GET /widgets/new # GET /widgets/new.xml def new @widget = Widget.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @widget } end end # GET /widgets/1/edit def edit @widget = Widget.find(params[:id]) end # POST /widgets # POST /widgets.xml def create @widget = Widget.new(params[:widget]) respond_to do |format| if @widget.save format.html { redirect_to(@widget, :notice => 'Widget was successfully created.') } format.xml { render :xml => @widget, :status => :created, :location => @widget } else format.html { render :action => "new" } format.xml { render :xml => @widget.errors, :status => :unprocessable_entity } end end end # PUT /widgets/1 # PUT /widgets/1.xml def update @widget = Widget.find(params[:id]) respond_to do |format| if @widget.update_attributes(params[:widget]) format.html { redirect_to(@widget, :notice => 'Widget was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @widget.errors, :status => :unprocessable_entity } end end end # DELETE /widgets/1 # DELETE /widgets/1.xml def destroy @widget = Widget.find(params[:id]) @widget.destroy respond_to do |format| format.html { redirect_to(widgets_url) } format.xml { head :ok } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
paginary-0.0.1.pre2 | test/dummy/app/controllers/widgets_controller.rb |
paginary-0.0.1.pre1 | test/dummy/app/controllers/widgets_controller.rb |