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 %>

Signup

<% if flash[:notice] %> <%= flash[:notice] + '
' %> <% end %>

Are you a 1or a 2?

<%= start_form_tag “/signup/process_acct” %>
1: company next

company name <%= text_field ‘user’, ‘company_name’ %>

contact name <%= text_field ‘user’, ‘contact_name’ %>

firstname <%= text_field ‘user’, ‘firstname’ %>

lastname <%= text_field ‘user’, ‘lastname’ %>

email <%= text_field ‘user’, ‘email’ %>

phone <%= text_field ‘user’, ‘phone’ %>

address 1 <%= text_field ‘address’, ‘address_one’ %>

address 2 <%= text_field ‘address’, ‘address_two’ %>

city <%= text_field ‘address’, ‘city’ %>

state <%= text_field ‘address’, ‘state’ %>

zip <%= text_field ‘address’, ‘zip’ %>

password <%= text_field ‘user’, ‘password’ %>

<%= 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 [email protected]
					session[:verror] = 'address'
					session[:verror_ob] = @a
					raise
				end
				@n.address_id = @address.id
				if [email protected]
					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 [email protected]
					session[:verror] = 'address'
					raise
				end
				@c.address_id = @address.id
				if [email protected]
					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).