How do I retrieve Errors from multiple updates


Hey all,

I’m attempting to do a multiple record update and all is saving well,
but I can’t figure out how to display the errors.
Does anyone know how I can get the error messages back to the
flash[:notice] from this code? The @task variable below seems to
contain an array of some sort… But I can’t figure out what to call
to get the error message.

  @task = Task.update @params['task'].keys, @params['task'].values

I would really appreciate it if someone had some code they could send me
that would show me how to display each error message (if one exists). I
can see the error messages in the below dump but I can’t figure out how
to get at them.

@task.size => 2


#<Task:0x34f5c78 @attributes={“status”=>“0000000000”,
“created_on”=>“2005-10-10”, “started_on”=>nil, “name”=>“test”,
“assigned_to”=>“1”, “project_id”=>“9”, “completed_on”=>nil,
“esthours”=>“6”, “published”=>“0”, “creator_id”=>“1”, “priority”=>“0”,
“service_id”=>“2”, “id”=>“74”, “description”=>“test”, “difficulty”=>“0”,
“due_on”=>“2005-11-24”}, @errors=#<ActiveRecord::Errors:0x34f3f38
@base=#<Task:0x34f5c78 …>, @errors={}>, @new_record_before_save=nil>,

#<Task:0x3491670 @attributes={“status”=>“0000000000”,
“created_on”=>“2005-10-10”, “started_on”=>nil, “name”=>“Test new
procedures on DBMS04”, “assigned_to”=>“1”, “project_id”=>“9”,
“completed_on”=>nil, “esthours”=>“5”, “published”=>“0”,
“creator_id”=>“4”, “priority”=>“5”, “service_id”=>“2”, “id”=>“75”,
“description”=>“The new stored procs need to be tested”,
“difficulty”=>“3”, “due_on”=>“2005-10-25”},
@errors=#<ActiveRecord::Errors:0x348dec0 @base=#<Task:0x3491670 …>,
@errors={}>, @new_record_before_save=nil>

Help is much appreciated!

Brian H.
Web D.
Learning & Technology Services
Schofield 3-B
University of Wisconsin-Eau Claire
715 836 3585