Button_to uses POST Link_to uses GET, why? ROR
Posted
by JZ
on Stack Overflow
See other posts from Stack Overflow
or by JZ
Published on 2010-01-30T06:50:35Z
Indexed on
2010/04/10
23:03 UTC
Read the original article
Hit count: 449
ruby-on-rails
|link-to
I've ran into a ror problem using the link_to. Why does my link to use the GET method and my button_to use the POST method, after I specified my "method"=>"post" within the link_to parameters?
View:
<%= button_to "pdf", :action => 'getquote' %>
<%= link_to 'pdf', {:controller => 'inventories', :action => 'getquote', :method => :post } %>
Controller Method:
def getquote
@cart = find_cart
respond_to do |format|
format.pdf
end
end
Terminal Output (Button/Link, respectively):
Processing InventoriesController#getquote (for 127.0.0.1 at 2010-01-30 01:38:02) [POST]
Parameters: {"action"=>"getquote", "authenticity_token"=>"D2cwnHyTHgomdUM3wXBBXlOe4NQLmv1Srn0paLbExpQ=", "controller"=>"inventories"}
Processing InventoriesController#show (for 127.0.0.1 at 2010-01-30 01:39:07) [GET]
Parameters: {"method"=>"post", "action"=>"show", "id"=>"getquote", "controller"=>"inventories"}
© Stack Overflow or respective owner