Sam Donaldson
2006-Jun-01 19:27 UTC
[Rails] using :post => ''true'' still makes a GET request
Hi, In my link_to''s, i''m adding the additional parameter :post => ''true'' whenever I expect to change database state on the server. Problem is, when I look at the incoming requests, I see that they are all coming in as GET requests instead of POST requests. Also, the link adds post=true as a name value parameter in the URL as it would with GET requests. I have javascript enabled in my browser. Any help would be appreciated. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060601/c6e98a51/attachment-0001.html
Jeremy Kemper
2006-Jun-01 19:48 UTC
[Rails] using :post => ''true'' still makes a GET request
On Jun 1, 2006, at 12:27 PM, Sam Donaldson wrote:> In my link_to''s, i''m adding the additional parameter :post => > ''true'' whenever I expect to change database state on the server. > Problem is, when I look at the incoming requests, I see that they > are all coming in as GET requests instead of POST requests. Also, > the link adds post=true as a name value parameter in the URL as it > would with GET requests. I have javascript enabled in my browser. > > Any help would be appreciated.Pass :post => true in the second hash argument: link_to ''here'', { :action => ''here'', :id => 1 }, { :post => true } link_to ''here'', here_url(:id => 1), :post => true jeremy
Daniel Burkes
2006-Jun-01 21:59 UTC
[Rails] Re: using :post => ''true'' still makes a GET request
> Pass :post => true in the second hash argument: > > link_to ''here'', { :action => ''here'', :id => 1 }, { :post => true } > link_to ''here'', here_url(:id => 1), :post => true >Also, realize that, on clients with Javascript disabled, these links will still use GET. So be sure to use something like if request.post? do_my_business end in your controller method. -- Posted via http://www.ruby-forum.com/.