Link_to with :method as :post

Hello,
I am using link_to helper to post the request. i want to hide the
extra parameters. so i have tried :method => :post also :post => true.
but it’s not works for me. still it shows query string. can any one
suggest proper solution?

Is hard to hide the qiery string but i can be done , how many params you
have?

On Tue, Sep 7, 2010 at 3:44 AM, Priyanka P.
[email protected]wrote:

Hello,
I am using link_to helper to post the request. i want to hide the
extra parameters. so i have tried :method => :post also :post => true.
but it’s not works for me. still it shows query string. can any one
suggest proper solution?

POST is not the same as “GET with the parameters hidden.” Read about the
HTTP methods here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

Basically, GET is for retrieval, and POST is for resource creation. If
you’re doing a retrieval, the method should be GET, not POST. There’s a
reason anchor tags (created by link_to) cannot do POST: because they are
just supposed to link two documents together, not affect state.

Priyanka P. wrote:

Hello,
I am using link_to helper to post the request. i want to hide the
extra parameters. so i have tried :method => :post also :post => true.
but it’s not works for me. still it shows query string. can any one
suggest proper solution?

Hi,
I have make the patch in rails 2.3.5 and my problem is solved. Here
is the source for it
http://dev.rubyonrails.org/attachment/ticket/8106/add_ability_to_specify_post_variables_with_link_to.diff

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs