hey, 
i want to have the validation of a model being parsed in to a string and added
to a global string. I read an csv file, do validation, and create an error
message for each record, and add that to the global error message to display it
later to the user
i used this code, but i dont get it to work
@msg = ""
looping...
error = false
errormsg = ""
employee = Employee.find(:all, :conditions =>[''firm_id = ? and
first_name = ?
and last_name = ? '', firm_id, first_name, last_name])
if employee.empty?
	error = false
else
	error = true #name already exist
	errormsg = "Firstname and lastname are already taken."
end
if error 
	@msg += "Record: " + first_name + ", " + last_name +
", " + phone + ", " +
phone_pin + ", " + errormsg + "<br/>"
else
	@tempemployee= Employee.new
	#SETING THE VALUES TO THE OBJECT
	....
	#SAVING THE OBJECT
	if @tempemployee.save
	else			
		 err = parse_errors(''employee'')
                 @msg += "Record: ""saving error" + err +
"<br/>"
	end
end
----------------
the method i use
----------------
 def parse_errors(obj, strip=false)   
      return nil if obj.nil?
      err = error_messages_for(obj)
      err[/(.*)<p>There were problems with the following
fields:<\/p>(.*)<\/div>/] if !err.nil?     
      return "" if $2.nil?
      str = "<b>" + $2.to_s + "</b>"
      str.gsub!(/<ul>/,'''');
      str.gsub!(/<\/ul>/,'''');
      str.gsub!(/''''/, "\\\\''") unless
strip==true
      return str
end
-----------------
the error i get
----------------
undefined method `error_messages_for'' for
#<EmployeesController:0x3778838>
i need this to work in the controller, not in the rhtml, cuz it is in a loop.
thanks in advance
Nick