This project is archived and is in readonly mode.
link_to does not merge parameters into request when :method => put
Reported by Jarl Friis | August 28th, 2009 @ 10:05 AM
In an action view I have a line like this
link_to 'Update timestamp', order_path(order, :update_timestamp => true), :method => :put
The generated HTML, creates a link with a onclick attribute that
ensures that the request is done via PUT (or rather "simulated put"
using a POST), however this form does not include the parameter
":update_timestamp => true
".
So the generated HTTP request when I click the link is a HTTP
REQUEST is like this
POST /orders/12?update_timestamp=true HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 77
_method=put&authenticity_token=0CSVKo0DOV53oKiCV6f1qhE68VmEjroSgrZel5AgOxw%3D
But when it hits my controller the params is empty, where as I
would have expected params[:order][:update_timestamp] ==
true
Jarl
Comments and changes to this ticket
-
Jarl Friis August 28th, 2009 @ 10:15 AM
Sorry. My fault
params is not empty, params[:order] is empty, but when I fixed it to
link_to 'Update timestamp', order_path(order, :order => {:update_timestamp => true}), :method => :put
Everything seems to work as expected.
Jarl
-
CancelProfileIsBroken August 28th, 2009 @ 12:11 PM
- State changed from new to invalid
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>