1 class MerchandiseController < ApplicationController
3 # Make sure that a user logs in before doing any action here
4 before_filter :authorize
8 render :action => 'list'
11 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
12 verify :method => :post, :only => [ :destroy, :create, :update ],
13 :redirect_to => { :action => :list }
16 @merchandise_pages, @merchandises = paginate :merchandises, :per_page => 10
20 @merchandise = Merchandise.find(params[:id])
24 @merchandise = Merchandise.new
28 @merchandise = Merchandise.new(params[:merchandise])
30 flash[:notice] = 'Merchandise was successfully created.'
31 redirect_to :action => 'list'
33 render :action => 'new'
38 @merchandise = Merchandise.find(params[:id])
42 @merchandise = Merchandise.find(params[:id])
43 if @merchandise.update_attributes(params[:merchandise])
44 flash[:notice] = 'Merchandise was successfully updated.'
45 redirect_to :action => 'show', :id => @merchandise
47 render :action => 'edit'
52 Merchandise.find(params[:id]).destroy
53 redirect_to :action => 'list'