Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #6662 (closed defect: untested)

Opened 2 years ago

Last modified 5 months ago

observe_form and observe_field dont send field data if :method is :put

Reported by: craigambrose Assigned to: sam
Priority: normal Milestone: 2.x
Component: Prototype Version: edge
Severity: normal Keywords: observe_form observe_field with put
Cc: mislav

Description

NOTE: although demonstrated using helpers, I believe this is a prototype bug.

In a restful application, observe_form is used to submit using the post method as follows.

  observe_form('my_form', story_subscription_path(:id => nil), :method => :post, :with => 'value=value')

Mongrel logs show that the create action is called on the StorySubscriptions controller, with the following parameters:

{"story_subscription"=>{"continue_page_i_follow"=>"1", "continue_page_i_wrote"=>"1"}, "action"=>"create", "controller"=>"story_subscriptions"}

Now, I want to submit to the update action instead. The controller is RESTful, so I need to do so using PUT. The observe_form call is changed to:

  observe_form('my_form', story_subscription_path(:id => @story_subscription), :method => :put, :with => 'value=value')

Mongrel logs the following:

Parameters: {"action"=>"update", "id"=>"1", "controller"=>"story_subscriptions"}

I've tried the same with using the javascript Form.Observer directly. Same result, hence the bug is probably in prototype. Also tried a seperate observe_field for each field, again with the same result.

Change History

11/21/06 13:04:14 changed by mislav

  • cc set to mislav.

Could you open the source of your web page and find code generated with the observe_form helper?

(in reply to: ↑ description ) 11/23/06 14:20:03 changed by RurouniJones

I think 6553 is related to this problem as well. In that case it was that the RESTful URLs are not getting created "properly" when the id is set in the :with hash

01/30/08 04:05:55 changed by Tobie

  • status changed from new to closed.
  • resolution set to untested.

Closing as untested. Please provide a fialing test case and reopen the ticket. Thanks!