ProductsController

Public Instance Methods

create() click to toggle source

POST /products POST /products.xml

    # File app/controllers/products_controller.rb, line 42
42:   def create

43:     @product = Product.new(params[:product])

44: 

45:     respond_to do |format|

46:       if @product.save

47:         format.html { redirect_to(@product, :notice => 'Product was successfully created.') }

48:         format.xml  { render :xml => @product, :status => :created, :location => @product }

49:       else

50:         format.html { render :action => "new" }

51:         format.xml  { render :xml => @product.errors, :status => :unprocessable_entity }

52:       end

53:     end

54:   end
destroy() click to toggle source

DELETE /products/1 DELETE /products/1.xml

    # File app/controllers/products_controller.rb, line 74
74:   def destroy

75:     @product = Product.find(params[:id])

76:     @product.destroy

77: 

78:     respond_to do |format|

79:       format.html { redirect_to(products_url) }

80:       format.xml  { head :ok }

81:     end

82:   end
edit() click to toggle source

GET /products/1/edit

    # File app/controllers/products_controller.rb, line 36
36:   def edit

37:     @product = Product.find(params[:id])

38:   end
index() click to toggle source

GET /products GET /products.xml

    # File app/controllers/products_controller.rb, line 4
 4:   def index

 5:     @products = Product.all

 6: 

 7:     respond_to do |format|

 8:       format.html # index.html.erb

 9:       format.xml  { render :xml => @products }

10:     end

11:   end
new() click to toggle source

GET /products/new GET /products/new.xml

    # File app/controllers/products_controller.rb, line 26
26:   def new

27:     @product = Product.new

28: 

29:     respond_to do |format|

30:       format.html # new.html.erb

31:       format.xml  { render :xml => @product }

32:     end

33:   end
show() click to toggle source

GET /products/1 GET /products/1.xml

    # File app/controllers/products_controller.rb, line 15
15:   def show

16:     @product = Product.find(params[:id])

17: 

18:     respond_to do |format|

19:       format.html # show.html.erb

20:       format.xml  { render :xml => @product }

21:     end

22:   end
update() click to toggle source

PUT /products/1 PUT /products/1.xml

    # File app/controllers/products_controller.rb, line 58
58:   def update

59:     @product = Product.find(params[:id])

60: 

61:     respond_to do |format|

62:       if @product.update_attributes(params[:product])

63:         format.html { redirect_to(@product, :notice => 'Product was successfully updated.') }

64:         format.xml  { head :ok }

65:       else

66:         format.html { render :action => "edit" }

67:         format.xml  { render :xml => @product.errors, :status => :unprocessable_entity }

68:       end

69:     end

70:   end
who_bought() click to toggle source
    # File app/controllers/products_controller.rb, line 84
84:   def who_bought

85:     @product = Product.find(params[:id])

86: 

87:     respond_to do |format|

88:       format.atom

89:       format.xml { render :xml => @product }

90:     end

91:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.