problems changing button_to to link_to

Hi,

I tried changing button_to to link_to without changing other parameters.

The path upon clicking the button is 'localhost/generals/ empty_creator. Hovering over button and link shows the same path for both. But with 'link_to' I get the error 'Couldn't find General with ID=empty_creator'. If I add :id => "1" to the link_to tag, it works, despite the id is useless as empty_creator doesn't require any parameters.

What is the correct way of doing this? I want to avoid using such tricks which could make the code confusing in future.

Thank you very much!

The difference is that link_to is using HTTP method GET, and button_to
is using POST. Your application is probably restful, and treats GET
and POST differently (GET is getting an existing object, POST is
creating new one).

So if you have restful application (i.e. it cares about HTTP method),
you can't replace link_to with button_to or vice versa.

izidor