class Admin::ItemsController < ApplicationController layout "admin" protect_from_forgery :only => [:create, :update, :destroy] def index @items = Item.find(:all) end def new @item = Item.new end def show @item = Item.find(params[:id]) end def create @item = Item.new(params[:item]) if @item.save flash[:notice] = 'Item was successfully created.' redirect_to :controller => 'items', :action => 'show', :id => @item, :new => 'true' else render :action => 'new' end end def edit @item = Item.find(params[:id]) end def update @item = Item.find(params[:id]) @item.update_attributes(params[:item]) render :partial => "item", :object => @item end def destroy Item.find(params[:id]).destroy render :nothing => true end end