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
On 24.5.2008, at 12:25, pepa007 wrote:
>
> 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!
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---