# Link\_to with :method as :post

**URL:** <https://www.ruby-forum.com/t/link-to-with-method-as-post/194570>\
**Category:** Rails\
**Created:** [September 7, 2010, 10:44am UTC](https://www.ruby-forum.com/t/link-to-with-method-as-post/194570 "2010-09-07T10:44:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![priyanka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/919ad9/32.png) [@priyanka](https://www.ruby-forum.com/u/priyanka)\
**Post date:** [September 7, 2010, 10:44am UTC](https://www.ruby-forum.com/t/link-to-with-method-as-post/194570/1 "2010-09-07T10:44:49Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![priyanka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/919ad9/32.png) [@priyanka](https://www.ruby-forum.com/u/priyanka)\
**Post date:** [September 7, 2010, 3:55pm UTC](https://www.ruby-forum.com/t/link-to-with-method-as-post/194570/2 "2010-09-07T15:55:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![priyanka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/919ad9/32.png) [@priyanka](https://www.ruby-forum.com/u/priyanka)\
**Post date:** [September 7, 2010, 7:48pm UTC](https://www.ruby-forum.com/t/link-to-with-method-as-post/194570/3 "2010-09-07T19:48:08Z")

</div>

On Tue, Sep 7, 2010 at 3:44 AM, Priyanka P.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)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/1.1: Method Definitions](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.

---

<div class="post-metadata">

**Author:** ![priyanka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/919ad9/32.png) [@priyanka](https://www.ruby-forum.com/u/priyanka)\
**Post date:** [September 8, 2010, 9:34am UTC](https://www.ruby-forum.com/t/link-to-with-method-as-post/194570/4 "2010-09-08T09:34:05Z")

</div>

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](http://dev.rubyonrails.org/attachment/ticket/8106/add_ability_to_specify_post_variables_with_link_to.diff)
