Sha256: 126585864f15f1a53c7edb5dbb1c968511bfdc228a2404b10e8b8a0cc26e0858
Contents?: true
Size: 1.81 KB
Versions: 1
Compression:
Stored size: 1.81 KB
Contents
class ItemsController < ApplicationController # GET /items # GET /items.json def index @items = Item.all respond_to do |format| format.html # index.html.erb format.json { render json: @items } end end # GET /items/1 # GET /items/1.json def show @item = Item.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @item } end end # GET /items/new # GET /items/new.json def new @item = Item.new respond_to do |format| format.html # new.html.erb format.json { render json: @item } end end # GET /items/1/edit def edit @item = Item.find(params[:id]) end # POST /items # POST /items.json def create @item = Item.new(params[:item]) respond_to do |format| if @item.save format.html { redirect_to @item, notice: 'Item was successfully created.' } format.json { render json: @item, status: :created, location: @item } else format.html { render action: "new" } format.json { render json: @item.errors, status: :unprocessable_entity } end end end # PUT /items/1 # PUT /items/1.json def update @item = Item.find(params[:id]) respond_to do |format| if @item.update_attributes(params[:item]) format.html { redirect_to @item, notice: 'Item was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @item.errors, status: :unprocessable_entity } end end end # DELETE /items/1 # DELETE /items/1.json def destroy @item = Item.find(params[:id]) @item.destroy respond_to do |format| format.html { redirect_to items_url } format.json { head :no_content } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
disable_connection_pooling-0.1.0 | spec/rails/3.2/app/controllers/items_controller.rb |