Validation doesn't work (newbie in Rails)

Hi guys,

I am newbie in Rails world and I am using the Agile Web Development with
Rails book to learn Rails.

I am trying to create a simple example using validation, actually only
one field on the User Interface and this field uses the
validates_presence_of validation.

Although this is a simple example, it doesn't work for me. Below
following the source code of the VIEW, CONTROLLER, MODEL.

View (index.html.erb)
<%= error_messages_for :product %>
<% form_for :product,:url => {:action => :create} do |form| %>
  Name: <%= form.text_field :name, :size => 30 %><br />
  <%= submit_tag %>
<% end %>

Controller (products_controller.rb)
class ProductsController < ApplicationController

  def index

  def create
    @product =[:product])

Model (products.rb)
class Products < ActiveRecord::Base
  validates_presence_of :name, :message => "This is a required field"

The only problem I can see off hand is that you might need to change
your create action:

  def create
    @product =[:product])
       redirect_to :action => :list
       render :action => :index