# Button\_to results in wrong route?

**URL:** <https://www.ruby-forum.com/t/button-to-results-in-wrong-route/178166>\
**Category:** Rails\
**Created:** [October 30, 2009, 3:12am UTC](https://www.ruby-forum.com/t/button-to-results-in-wrong-route/178166 "2009-10-30T03:12:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eichlerguy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/4af34b/32.png) [@eichlerguy](https://www.ruby-forum.com/u/eichlerguy)\
**Post date:** [October 30, 2009, 3:12am UTC](https://www.ruby-forum.com/t/button-to-results-in-wrong-route/178166/1 "2009-10-30T03:12:02Z")

</div>

Hi, all,

Newbie question.

When using button\_to, the browser navigates to a proper URL (http://  
localhost:3000/sites/6/edit, for example), but I get a “No action  
responded to 6” error. Looking in the log, I see “Processing  
SitesController#6” instead of Processing SitesController#edit".

The problem goes away when I use link\_to, or if I type the URL by  
hand.

Any ideas? In advance, thanks.

---

<div class="post-metadata">

**Author:** ![eichlerguy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/4af34b/32.png) [@eichlerguy](https://www.ruby-forum.com/u/eichlerguy)\
**Post date:** [October 30, 2009, 6:33am UTC](https://www.ruby-forum.com/t/button-to-results-in-wrong-route/178166/2 "2009-10-30T06:33:57Z")

</div>

post some code that you are using.

---

<div class="post-metadata">

**Author:** ![eichlerguy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/4af34b/32.png) [@eichlerguy](https://www.ruby-forum.com/u/eichlerguy)\
**Post date:** [October 30, 2009, 6:36am UTC](https://www.ruby-forum.com/t/button-to-results-in-wrong-route/178166/3 "2009-10-30T06:36:26Z")

</div>

Hi eichlerguy

```
The differnce is button_to generates a form with method post in your 

```

case and link\_to generates a link with method put in this case.And  
link\_to is the one you want here

Sijo
