1 error(s) on assignment of multiparameter attributes - Very Strange


#1

Hello…

Well, I post this one without too much hope that someone will be able
to give me an answer, because it is strange.

I have a time select field, the field on the database is of type time
only.

When creating a document, as long as the time is not greater than
14:00, then it saves as 00:00, but if the time is greater than 14:00
and less than 22:00 then it throws this error:

1 error(s) on assignment of multiparameter attributes

Too make things fun, when I update the document, no problem, I can
enter any time and it saves.

Here are the values being passed, in this example, the dropofftime is
20:20.

Parameters: {“commit”=>“Create”, “shipment”=>{“num_boxes2”=>“0”,
“clientref”=>“23242”, “AWB”=>“34556”, “num_boxes3”=>“0”, “weight”=>"",
“box_type1”=>"", “shipper_id”=>“3”, “box_type2”=>"",
“dropofftime(1i)”=>"", “box_type3”=>"", “dropofftime(2i)”=>"",
“dropofftime(3i)”=>"", “dropofftime(4i)”=>“20”,
“dropofftime(5i)”=>“20”, “consignee_id”=>“2”, “num_boxes1”=>“0”}}

Full trace follows:

C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/
base.rb:2097:in execute_callstack_for_multiparameter_attributes' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/ base.rb:2077:inassign_multiparameter_attributes’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/
base.rb:1678:in attributes=' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/ base.rb:1508:ininitialize_without_callbacks’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/
callbacks.rb:225:in initialize' C:/ruby/bin/TrackAndTrace/app/controllers/shipments_controller.rb: 57:innew’
C:/ruby/bin/TrackAndTrace/app/controllers/shipments_controller.rb:
57:in create' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/ base.rb:1101:insend’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/
base.rb:1101:in perform_action_without_filters' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/ filters.rb:696:incall_filters’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/
filters.rb:688:in perform_action_without_benchmark' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/ benchmarking.rb:66:inperform_action_without_rescue’
C:/ruby/lib/ruby/1.8/benchmark.rb:293:in measure' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/ benchmarking.rb:66:inperform_action_without_rescue’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/
rescue.rb:83:in perform_action' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/ base.rb:435:insend’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/
base.rb:435:in process_without_filters' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/ filters.rb:684:inprocess_without_session_management_support’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/
session_management.rb:114:in process' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/ base.rb:334:inprocess’
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/dispatcher.rb:41:in
dispatch' C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/webrick_server.rb: 113:inhandle_dispatch’
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/webrick_server.rb:79:in
service' C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in run' C:/ruby/lib/ruby/1.8/webrick/server.rb:173:instart_thread’
C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:162:instart_thread’
C:/ruby/lib/ruby/1.8/webrick/server.rb:95:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:92:ineach’
C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:23:instart’
C:/ruby/lib/ruby/1.8/webrick/server.rb:82:in start' C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/webrick_server.rb:63:indispatch’
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/servers/
webrick.rb:59
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/
dependencies.rb:495:in require' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/ dependencies.rb:342:innew_constants_in’
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/
dependencies.rb:495:in require' C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/server.rb:39 C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:ingem_original_require’
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require’
script/server:3

Any help, greatly appreciated.

Thanks,

GPB


#2

Well I figured it out.

I was using <%= time_select ‘shipment’, ‘dropofftime’, :include_blank
=> false %>

Even though include_blank does give a blank option in the select list,
it seems it forces rail to interpret the field as a datetime_select
field instead of a time only field.

This is why the form was passing dropofftime(1i) to dropofftime(4i)
instead of only two necesarry for the hours and the minutes. Depending
on the time selected, it would sometime fail, since it would interpret
it as a date.

Take out the include_blank, and the problem is fixed.

However, I think the include_blank should be available and not cause
this unexpected behavior. Anyone know how to get blanks for a
time_select field?

GPB