I have a link_to like this:
<%= link_to "Nuevo Contrato", {:controller => "hotels", :action => "edit", :id => @hotel_id, :selected_tab => "4"}, :class => "new_link" %>
The开发者_运维知识库re's a way to send those parameters not using the query string for it? (using post instead of a get) ??
Thank you!
I already tried:
<%= link_to "Nuevo Contrato", {:controller => "hotels", :action => "edit", :id => @hotel_id, :selected_tab => "4"}, {:method => :post,:class => "new_link"} %>
And it keeps doing the same thing...!
Add a supported HTTP verb in the method option.
<%= link_to "link", {:method => :post ...} %>
I think you can just add :method => :post
to the options of link_to
.
Here are the docs (for Rails 3, but I think this still holds true for Rails 2 also) http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to
EDIT FOR UPDATED QUESTION
:method => :post
belongs in the HTML options, not the URL options. This is not very obvious from the documentation.
<%= link_to "Nuevo Contrato", {:controller => "hotels", :action => "edit", :id => @hotel_id, :selected_tab => "4"}, {:method => :post, :class => "new_link"} %>
精彩评论