Class AdminController
In: app/controllers/admin_controller.rb
Parent: ApplicationController

Methods

create   destroy   edit   index   list   new   show   update  

Public Instance methods

[Source]

    # File app/controllers/admin_controller.rb, line 25
25:   def create
26:     @product = Product.new(params[:product])
27:     if @product.save
28:       flash[:notice] = 'Product was successfully created.'
29:       redirect_to :action => 'list'
30:     else
31:       render :action => 'new'
32:     end
33:   end

[Source]

    # File app/controllers/admin_controller.rb, line 49
49:   def destroy
50:     Product.find(params[:id]).destroy
51:     redirect_to :action => 'list'
52:   end

[Source]

    # File app/controllers/admin_controller.rb, line 35
35:   def edit
36:     @product = Product.find(params[:id])
37:   end

[Source]

   # File app/controllers/admin_controller.rb, line 4
4:   def index
5:     list
6:     render :action => 'list'
7:   end

[Source]

    # File app/controllers/admin_controller.rb, line 13
13:   def list
14:     @product_pages, @products = paginate :products, :per_page => 10
15:   end

[Source]

    # File app/controllers/admin_controller.rb, line 21
21:   def new
22:     @product = Product.new
23:   end

[Source]

    # File app/controllers/admin_controller.rb, line 17
17:   def show
18:     @product = Product.find(params[:id])
19:   end

[Source]

    # File app/controllers/admin_controller.rb, line 39
39:   def update
40:     @product = Product.find(params[:id])
41:     if @product.update_attributes(params[:product])
42:       flash[:notice] = 'Product was successfully updated.'
43:       redirect_to :action => 'show', :id => @product
44:     else
45:       render :action => 'edit'
46:     end
47:   end

[Validate]