Public feed #893431

Something

public text v1 · immutable
Raw Edit
·published 2008-02-06 03:12 UTC
rendered paste body
class ProductsController < ApplicationController
    def list
      @products = Product.find(:all)
    end
   
    def show
      @products = Product.find(params[:id])
    end
    
    def new
      @product = Product.new
    end
    
    def create
      @product = Product.new(params[:product])
            if @product.save
            redirect_to :action => 'list'
            end
    end


<h1>Add new product</h1>

<% form_tag :action => 'create' do %>
  <p><label for="product_name">Product Name</label>:
	<%= text_field 'product', 'name' %></p>

	<p><label for="product_price">Price</label>:
	<%= text_field 'product', 'price' %></p>

	<p><label for="product_description">Description</label><br/>
	<%= text_area 'product', 'description' %></p>

	<%= submit_tag "Create" %>
<% end %>