Validation error objects?

I'm trying to figure out validation. I was looking at what exactly is going on when using scaffolding and the error_messages_for method. I'm not sure exactly what to ask.. My situation is that I have a form that submits to a process method, and depending on one of the options, it creates a new user type.. the validation examples in scaffolding are so simple thought that when tearing it down and trying to bring it to my particular case it doesn't work.

here is the form:

<%= session[:verror_ob].errors if session[:verror_obj] != nil %> <h2>Signup</h2> <% if flash[:notice] %> <%= flash[:notice] + '<br/>' %> <% end %>

Are you a 1or a 2? <br/> <%= start_form_tag "/signup/process_acct" %> 1: <input type="radio" name="acctType" value="1" /> company next<br/> company name <%= text_field 'user', 'company_name' %><br/> contact name <%= text_field 'user', 'contact_name' %><br/> firstname <%= text_field 'user', 'firstname' %><br/> lastname <%= text_field 'user', 'lastname' %><br/> email <%= text_field 'user', 'email' %><br/> phone <%= text_field 'user', 'phone' %><br/> address 1 <%= text_field 'address', 'address_one' %><br/> address 2 <%= text_field 'address', 'address_two' %><br/> city <%= text_field 'address', 'city' %><br/> state <%= text_field 'address', 'state' %><br/> zip <%= text_field 'address', 'zip' %><br/> password <%= text_field 'user', 'password' %><br/> <%= submit_tag "Signup!" %> <%= end_form_tag %>

here is the process ruby:

def process_acct     @user = params[:user]     @acct_type = params[:acctType]     @address = Address.new(params[:address])

    if @acct_type == '1'       @n = Nurse.new       @n.firstname = @user['firstname']       @n.lastname = @user['lastname']       @n.email = @user['email']       @n.phone = @user['phone']       @n.password = Digest::SHA1.hexdigest(@user['password'])       begin         Nurse.transaction(@address, @n) do           if !@address.save             session[:verror] = 'address'             session[:verror_ob] = @a             raise           end           @n.address_id = @address.id           if !@n.save             session[:verror] = 'nurse'             session[:verror_ob] = @n             raise           end         end       rescue Exception => error         redirect_to :action => 'index'         return       end

    elsif @acct_type == 'company'       @c = Company.new       @c.company_name = @user['company_name']       @c.contact_name = @user['contact_name']       @c.email = @user['email']       @c.phone = @user['phone']       @c.password = Digest::SHA1.hexdigest(@user['password'])       begin         Company.transaction(@address, @c) do           if !@address.save             session[:verror] = 'address'             raise           end           @c.address_id = @address.id           if !@c.save             session[:verror] = 'company'             raise           end         end       rescue Exception => error         redirect_to :action => 'index'         return       end

    else       redirect_to :action => 'index'       return     end

    #all went well     redirect_to :controller => 'login'     return

So how do I know what object to use the .error property for? in the case of validation (source from error_messages_for).