# Link\_to with :method doesn't work for me (newbie)

**URL:** <https://www.ruby-forum.com/t/link-to-with-method-doesnt-work-for-me-newbie/162929>\
**Category:** Rails\
**Created:** [March 15, 2009, 10:01pm UTC](https://www.ruby-forum.com/t/link-to-with-method-doesnt-work-for-me-newbie/162929 "2009-03-15T22:01:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jazcyk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e56c9b/32.png) [@jazcyk](https://www.ruby-forum.com/u/jazcyk)\
**Post date:** [March 15, 2009, 10:01pm UTC](https://www.ruby-forum.com/t/link-to-with-method-doesnt-work-for-me-newbie/162929/1 "2009-03-15T22:01:01Z")

</div>

Hi,

I have a nice link which I intend to have non-idempotent consequences  
and so after a quick google I realized I want to use link\_to with the  
:method =\> :post option.

Only problem is that this stubbornly refuses to work for me. Using this  
option produces HTML like:

[ 

clearly here this is not being interpreted correctly.

 

I updated my rails today to 2.2.2. But I don’t know if I need to update  
my application also. I tried using the older :post =\> true method too,  
but it got turned into a GET Url also.

 

Is my rails project somehow outdated?

 

Thanks for any help you nay offer!

](https://www.ruby-forum.com/events/moderate?method=post)

---

<div class="post-metadata">

**Author:** ![jazcyk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e56c9b/32.png) [@jazcyk](https://www.ruby-forum.com/u/jazcyk)\
**Post date:** [March 15, 2009, 10:39pm UTC](https://www.ruby-forum.com/t/link-to-with-method-doesnt-work-for-me-newbie/162929/2 "2009-03-15T22:39:52Z")

</div>

On Mar 15, 9:01 pm, Peter L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hi,
> 
> I have a nice link which I intend to have non-idempotent consequences  
> and so after a quick google I realized I want to use link\_to with the  
> :method =\> :post option.

Looks like you are doing

link\_to ‘foo’, :some\_routing\_param =\> ‘bar’, :method =\> :post

If you do that then method =\> :post ends up in the hash of url  
parameters which isn’t what you want. You want it to be in the second  
hash of html options, which means you need to do  
link\_to(‘foo’, {:some\_routing\_params =\> ‘bar’, …}, :method =\> :post)

Fred
