# How to fix routing error?

**URL:** <https://www.ruby-forum.com/t/how-to-fix-routing-error/122004>\
**Category:** Rails\
**Created:** [December 3, 2007, 8:10pm UTC](https://www.ruby-forum.com/t/how-to-fix-routing-error/122004 "2007-12-03T20:10:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tdellaringa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7bcc69/32.png) [@tdellaringa](https://www.ruby-forum.com/u/tdellaringa)\
**Post date:** [December 3, 2007, 8:10pm UTC](https://www.ruby-forum.com/t/how-to-fix-routing-error/122004/1 "2007-12-03T20:10:49Z")

</div>

Working through the Depot application in Agile (and having lots of fun).  
I’m on Iteration C3 - Handling Errors. I just added the flash to the  
add\_to\_cart method in the store controller. Then I try the faulty URL  
/store/add\_to\_cart/wibble to see my flash handle the error, but instead  
I get this:

no route found to match  
“/store/#Product:0x48e872c/#Product:0x48e86f0/#Product:0x48e86c8”  
with {:method=\>:get}

I tried googling this but no luck. I’ve proofread my additions to the  
method and they appear correct. Any idea what this can be?

---

<div class="post-metadata">

**Author:** ![tdellaringa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7bcc69/32.png) [@tdellaringa](https://www.ruby-forum.com/u/tdellaringa)\
**Post date:** [December 3, 2007, 8:50pm UTC](https://www.ruby-forum.com/t/how-to-fix-routing-error/122004/2 "2007-12-03T20:50:06Z")

</div>

Still poking around with this and having no luck, but one thing I  
noticed in the error message:

with {:method=\>:get}

The book makes it explicit to use a post method of adding to cart,  
making sure button\_to was used instead of link\_to:

\<%= button\_to “Add to Cart”, :action =\> :add\_to\_cart, :id =\> product %\>

(Side note: then a couple pages later, they tell you to link the image  
up to the add\_to\_cart method using link\_to - making no sense whatsoever  
to restricting it to a button in the first place)

Is this happening because hacking the URL is a GET vs. a POST?
