Link_to with :method doesn't work for me (newbie)


#1

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!


#2

On Mar 15, 9:01 pm, Peter L. 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