Hi – I’ve got a very strange error.
I have an action called ‘commit_input’ on a controller called
‘SiteVisitController’. This definately exists, and is called from the
functional test for it, and passes fine.
My problem is with the form that is supposed to call this action.
The form tag is:
<%= form_tag({:action=>‘commit_input’}) %>
<%# various controls – listed in full below -%>
<%= submit_tag ‘commit’ %>
<%= end_form_tag %>
When this is run, I get the page cannot be found screen, and the
following error in webrick’s console:
127.0.0.1 - - [06/Mar/2006:10:37:30 GMT Standard Time] “GET
/site_visit/input/1
HTTP/1.1” 200 153359
http://localhost:3000/admin/visit_data → /site_visit/input/1
#<NoMethodError: undefined method update' for "0":String> ["c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/cgi_ext/ cgi_methods.rb:116:in
build_deep_hash’",
“c:/ruby/lib/ruby/gems/1.8/gems/action
pack-1.9.1/lib/action_controller/cgi_ext/cgi_methods.rb:116:in
build_deep_hash' ", "c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/cgi_ex t/cgi_methods.rb:41:in
parse_request_parameters’”,
“c:/ruby/lib/ruby/gems/1.8/g
ems/actionpack-1.9.1/lib/action_controller/cgi_ext/cgi_methods.rb:39:in
each'", "c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/cgi_ext/ cgi_methods.rb:39:in
parse_request_parameters’”,
“c:/ruby/lib/ruby/gems/1.8/gem
s/actionpack-1.9.1/lib/action_controller/cgi_process.rb:74:in
request_parameter s'", "c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/requ est.rb:8:in
parameters’”,
“c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/
action_controller/base.rb:734:in assign_shortcuts'", "c:/ruby/lib/ruby/gems/1.8 /gems/actionpack-1.9.1/lib/action_controller/base.rb:351:in
process’”,
“c:/ruby
/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/rescue.rb:20:in
process_with_exception'", "c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispa tcher.rb:34:in
dispatch’”,
“c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/web
rick_server.rb:105:in handle_dispatch'", "c:/ruby/lib/ruby/gems/1.8/gems/rails- 0.13.1/lib/webrick_server.rb:71:in
service’”,
“c:/ruby/lib/ruby/1.8/webrick/htt
pserver.rb:104:in service'", "c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in
run’”, “c:/ruby/lib/ruby/1.8/webrick/server.rb:155:in start_thread'", "c:/ruby /lib/ruby/1.8/webrick/server.rb:144:in
start’”,
“c:/ruby/lib/ruby/1.8/webrick/s
erver.rb:144:in start_thread'", "c:/ruby/lib/ruby/1.8/webrick/server.rb:94:in
start’”, “c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in each'", "c:/ruby/lib/rub y/1.8/webrick/server.rb:89:in
start’”,
“c:/ruby/lib/ruby/1.8/webrick/server.rb:
79:in start'", "c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in
start’”,
"c:/ruby
/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:57:in
dispatch'", "s cript/server:49"] [2006-03-06 10:37:37] ERROR
/site_visit/commit_input’ not found.
127.0.0.1 - - [06/Mar/2006:10:37:37 GMT Standard Time] “POST
/site_visit/commit_
input HTTP/1.1” 404 293
http://localhost:3000/site_visit/input/1 → /site_visit/commit_input
I have been trying to fix this for a couple of days, now, and have tried
everything I can think of, including explicitly stating the controller
in the form tag, renaming the action, etc.
Has anyone else come accross (& hopefully solved) this problem?
If anyone can shed any light, I would be immensely grateful.
I’ll post the full form code at the bottom of this post.
Thanks for any & all help,
doug.
SI UPRN | School Name | Address 01 | |
---|---|---|---|
Postcode | |||
<%= @property.si_uprn %> | <%= @property.name %> | <%= @property.address1 %> | <%= @property.address_postcode %> |
<%= form_tag({:action=>‘commit_input’}) %>
Site Visit Times <% i=0 -%> <% @site_visit_helper.timesheet_records.each do |tr| -%> <% i+=1 -%> <% end -%>Surveyor | Date | Time Arrived | Time Left |
---|---|---|---|
<%= select_tag("site_visit_helper[timesheet_records][#{i.to_s}][surveyor_id]", options_for_select(@surveyors, tr.surveyor_id)) %> | <%= select_date( hash2date(tr.visited_on), :prefix=>"site_visit_helper[timesheet_records][#{i.to_s}][visited_on]", :include_blank=>true) %> | <%= select_time( hash2time(tr.arrived_at), :prefix=>"site_visit_helper[timesheet_records][#{i.to_s}][arrived_at]", :include_blank=>true, :minute_step=>5) %> | <%= select_time( hash2time(tr.left_at), :prefix=>"site_visit_helper[timesheet_records][#{i.to_s}][left_at]", :include_blank=>true, :minute_step=>5) %> |
Date | Card Number | First Photo Number | Last Photo Number |
---|---|---|---|
<%= select_date( hash2date(pr.taken_on), :prefix=>"site_visit_helper[photosheet_records][#{i.to_s}][taken_on]", :include_blank=>true) %> | <%= text_field_tag( "site_visit_helper[photosheet_records][#{i.to_s}][card_number]", pr.card_number) %> | <%= text_field_tag( "site_visit_helper[photosheet_records][#{i.to_s}][first_photo_number]", pr.first_photo_number) %> | <%= text_field_tag( "site_visit_helper[photosheet_records][#{i.to_s}][last_photo_number]", pr.last_photo_number) %> |
Name | Position | Man Days |
---|---|---|
<%= text_field(:site_visit_helper, :customer_sign_off_name) %> | <%= text_field(:site_visit_helper, :customer_sign_off_position) %> | <%= text_field(:site_visit_helper, :man_days) %> |
Date | Non Site Time | |
<%= select_date(hash2date( @site_visit_helper.customer_sign_off_date), :prefix=>"site_visit_helper[customer_sign_off_date]", :include_blank=>true) %> | <%= text_field(:site_visit_helper, :non_site_time) %> |
<%= text_area(:site_visit_helper, :sketch_index, :cols=>50, :rows=>10) %> |
Surveyor | Comments |
---|---|
<%= select_tag(:site_visit_helper, options_for_select(@surveyors)) %> | <%= text_area(:site_visit_helper, :comments, :cols=>38, :rows=>5) %> |
Date | |
<%= select_date(hash2date( @site_visit_helper.sign_off_date), :prefix=>"site_visit_helper[sign_off_date]", :include_blank=>true) %> | |
<%= submit_tag 'commit' %> |
<%= end_form_tag %>