Sha256: 9eb6a2f62174708ec52eb285ee340b64341e27fd82aac876d0effd35d19ad213
Contents?: true
Size: 1.78 KB
Versions: 2
Compression:
Stored size: 1.78 KB
Contents
class BoxesController < ApplicationController # GET /boxes # GET /boxes.json def index @boxes = Box.all respond_to do |format| format.html # index.html.erb format.json { render json: @boxes } end end # GET /boxes/1 # GET /boxes/1.json def show @box = Box.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @box } end end # GET /boxes/new # GET /boxes/new.json def new @box = Box.new respond_to do |format| format.html # new.html.erb format.json { render json: @box } end end # GET /boxes/1/edit def edit @box = Box.find(params[:id]) end # POST /boxes # POST /boxes.json def create @box = Box.new(params[:box]) respond_to do |format| if @box.save format.html { redirect_to @box, notice: 'Box was successfully created.' } format.json { render json: @box, status: :created, location: @box } else format.html { render action: "new" } format.json { render json: @box.errors, status: :unprocessable_entity } end end end # PUT /boxes/1 # PUT /boxes/1.json def update @box = Box.find(params[:id]) respond_to do |format| if @box.update_attributes(params[:box]) format.html { redirect_to @box, notice: 'Box was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @box.errors, status: :unprocessable_entity } end end end # DELETE /boxes/1 # DELETE /boxes/1.json def destroy @box = Box.find(params[:id]) @box.destroy respond_to do |format| format.html { redirect_to boxes_url } format.json { head :no_content } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nested_scaffold-0.2.1 | test/dummy/app/controllers/boxes_controller.rb |
nested_scaffold-0.2.0 | test/dummy/app/controllers/boxes_controller.rb |