Hey All,
My user just got bit by this problem (in my rails version 2.0.2 app):
http://railsmanual.com/class/ActiveRecord::MultiparameterAssignmentErrors
That is, if you use the date_select generated list boxes to select a
nonexistant date like say, April 31st, you get a stack trace like this
here:
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2397:in
execute_callstack_for_multiparameter_attributes' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2377:in
assign_multiparameter_attributes’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2120:in
attributes=' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2033:in
update_attributes’
app/controllers/projects_controller.rb:76:in update' app/controllers/projects_controller.rb:75:in
update’
You get the same exception if you
So… is there some particularly good place to fix this? I can
certainly pull the date components out of params[] in my controller, try
a Date.parse() on them & give the user a better error message. But I’ve
got date_select’s in lots of different places in my app & would love it
if I could just fix it in one spot…
I’ve looked in the attributes=() method in ar:base, but am a bit daunted
by it–have a hard time imagining I’m going to do more good than harm in
there…
Anybody got ideas for me?
Thanks!
-Roy
Roy P.
Research Analyst/Programmer
Group Health Center For Health Studies (Cancer Research Network)
(206) 287-2078
Google Talk: rpardee