Why isn't validation kicking in and how can I make it so?

Hi,

I have a model, ec_order, which has multiple ec_line_items. You start
a “new” order through the OrderController …

class OrderController < ApplicationController
def new
if logged_in?
@user = User.find(session[:user_id])
@ec_order = EcOrder.new
3.times { @ec_order.ec_line_items.build }
else
flash[:notice] = “You must be logged in to access this
page.”
redirect_to :controller => “register”, :action =>
“start”
end
end

    def summary
            @ec_order = EcOrder.new(params[:ec_order])
            session[:ec_order] = @ec_order
    end


end

Here’s the ec_line_item model:

class EcLineItem < ActiveRecord::Base
belongs_to :ec_order

    validates_numericality_of :prescription_number, :integer_only

=> true
end

In the form on the “new” view, you submit to the “summary” action.
How can I detect if the ec_line_item objects are valid or not and
reroute back to the “new” action? Thanks, - Dave

PS - If it’s useful, here’s the app/views/order/new.rhtml file:

===================Begin new.rhtml file=============================
<% form_for :ec_order, :url => ‘summary’ do |f| %>

<%= f.hidden_field :ship_first_name, :value => @user.ship_to_first_name %> <%= f.hidden_field :ship_last_name, :value => @user.ship_to_last_name %> <%= f.hidden_field :ship_street_address, :value => @user.ship_to_street %> <%= f.hidden_field :ship_city, :value => @user.ship_to_city %> <%= f.hidden_field :ship_state, :value => @user.ship_to_state %> <%= f.hidden_field :ship_zip, :value => @user.ship_to_zip %> <%= f.hidden_field :ship_country, :value => @user.ship_to_country %> <%= f.hidden_field :email, :value => @user.email %> <%= f.hidden_field :phone, :value => @user.phone %>
Item
<%= render :partial => 'ec_line_item', :collection => @ec_order.ec_line_items %>
<%= add_prescription_link "Add a prescription" %>
<%= submit_tag("Submit Form") %>
<% end %> ========================end new.rhtml file=============================