This project is archived and is in readonly mode.

#3112 ✓invalid
Jarl Friis

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

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>

People watching this ticket

Pages