# I'm stumped by this stupid newbie error I'm seeing... trying to figure out where to "look" next

**URL:** <https://www.ruby-forum.com/t/im-stumped-by-this-stupid-newbie-error-im-seeing-trying-to-figure-out-where-to-look-next/171529>\
**Category:** Rails\
**Created:** [July 4, 2009, 4:20am UTC](https://www.ruby-forum.com/t/im-stumped-by-this-stupid-newbie-error-im-seeing-trying-to-figure-out-where-to-look-next/171529 "2009-07-04T04:20:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9f8e36/32.png) [@rick](https://www.ruby-forum.com/u/rick)\
**Post date:** [July 4, 2009, 4:20am UTC](https://www.ruby-forum.com/t/im-stumped-by-this-stupid-newbie-error-im-seeing-trying-to-figure-out-where-to-look-next/171529/1 "2009-07-04T04:20:51Z")

</div>

On one of my new.html.erb files backed by a “matches\_controller” I’m  
getting the error:

undefined method `matches\_path’ for #ActionView::Base:0x2cfc748

I don’t understand where to start looking to try to understand why I’m  
getting this error. Even if I back everything out of the page and just  
have:

# New match
\<% form\_for(@match) do |f| %\> \<% end %\>

I still get the error.

What am I supposed to do to start tracking now where the issue is? Is  
it that I’m getting an error message that isn’t directly related at  
all to the 'matches\_path" issue.  
Other pages aren’t having this issue, so I’m a bit stumped.

I’m a rails newb (but seasoned java person so I have no problem  
looking in logs for errors… but the errors don’t seem to be helping  
me track down the ‘reai’ issue.)

Thanks for any direction of what to start looking at (is it maybe an  
obscure error in my controller or another page causing the problem?)

---

<div class="post-metadata">

**Author:** ![rick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9f8e36/32.png) [@rick](https://www.ruby-forum.com/u/rick)\
**Post date:** [July 4, 2009, 4:36am UTC](https://www.ruby-forum.com/t/im-stumped-by-this-stupid-newbie-error-im-seeing-trying-to-figure-out-where-to-look-next/171529/2 "2009-07-04T04:36:58Z")

</div>

Don’t feel bad mate - everyone here was a newb at one time or another.  
I’m still in my newb phase too :)…

So, first question I have to ask is are you using RESTful controllers?  
In otherwords, are you generating a scaffold and having all 7 RESTful  
methods created for you automatically?

index, new, show, create, edit, update, and destroy

By using REST, the controllers, the views, the models are all setup  
initially for you…

---

<div class="post-metadata">

**Author:** ![rick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9f8e36/32.png) [@rick](https://www.ruby-forum.com/u/rick)\
**Post date:** [July 4, 2009, 5:16am UTC](https://www.ruby-forum.com/t/im-stumped-by-this-stupid-newbie-error-im-seeing-trying-to-figure-out-where-to-look-next/171529/3 "2009-07-04T05:16:57Z")

</div>

Rick wrote:

> \<% form\_for(@match) do |f| %\>  
> \<% end %\>
> 
> I still get the error.
> 
> What am I supposed to do to start tracking now where the issue is? Is  
> it that I’m getting an error message that isn’t directly related at  
> all to the 'matches\_path" issue.  
> Other pages aren’t having this issue, so I’m a bit stumped.

I’m still a relative newby, so no worries 🙂

It’s a routing problem. The form\_for tries to generate a route relating  
to the matches controller, but the route doesn’t exist. Either you want  
to add something like

map.resources :matches

to config/routes.rb, or manually add a route in that same file, pointing  
to the controller/action you want. The resources mapping will generate a  
whole load of routes for that controller that use the RESTful  
principles.

You can add that above line and then run “rake routes” to list the  
structure. The new routes generate buy the line will be shown and should  
let you see what it does.

HTH

Matt

---

<div class="post-metadata">

**Author:** ![rick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9f8e36/32.png) [@rick](https://www.ruby-forum.com/u/rick)\
**Post date:** [July 4, 2009, 3:42pm UTC](https://www.ruby-forum.com/t/im-stumped-by-this-stupid-newbie-error-im-seeing-trying-to-figure-out-where-to-look-next/171529/4 "2009-07-04T15:42:40Z")

</div>

Rick wrote:

> On Fri, Jul 3, 2009 at 11:16 PM, Matt  
> Harrison[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > You can add that above line and then run “rake routes” to list the  
> > structure. The new routes generate buy the line will be shown and should  
> > let you see what it does.
> 
> Awesome. Thanks so much! I had created the other pages using the  
> scaffolding (which explains those entries in the routes.rb) but not  
> for this one (matches) which I manually started to make. Scaffolding  
> is nice but learn so much more from these mistakes doing it yourself  
> that you helped me with . Thanks again.

Yep, scaffolding is one of those things everyone, including myself -  
finds out about later on. Then there’s always some unloved MVC that  
gets forgotten in the shuffle. Again, glad you got everything working  
out.

Routing is very important and one of the intricate parts of rails.

You can also limit your routing for each of those scaffolds by doing  
something similar:

Say you want to restrict the route only to the index and you have  
RESTful methods in each of your scaffolds… you can do :

map.resources :name\_of\_controller, ‘/route’

You can also name specific routes/custom actions by…

map.name\_of\_route :name\_of\_route, :controller =\> ‘name\_of\_controller’,  
:action =\> ‘custom\_method’

And, you can also further provide a catchall route for anything not  
specified in your routes by doing the following:

map.connect “\*anything”, :controller =\> ‘your\_controller’, :action =\>  
‘request\_error\_page’

Place this one at the very bottom of your routes and create a custom  
view named request\_error\_page.html.erb and you can intercept anything  
that’s out of scope.

Routing is also important with where you place things. For instance,  
this last line if you placed it at the top of your routes file, it would  
catch everything and none of your other routes would work.

---

<div class="post-metadata">

**Author:** ![rick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9f8e36/32.png) [@rick](https://www.ruby-forum.com/u/rick)\
**Post date:** [July 4, 2009, 5:42am UTC](https://www.ruby-forum.com/t/im-stumped-by-this-stupid-newbie-error-im-seeing-trying-to-figure-out-where-to-look-next/171529/5 "2009-07-04T05:42:03Z")

</div>

On Fri, Jul 3, 2009 at 11:16 PM, Matt  
Harrison[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> You can add that above line and then run “rake routes” to list the  
> structure. The new routes generate buy the line will be shown and should  
> let you see what it does.

Awesome. Thanks so much! I had created the other pages using the  
scaffolding (which explains those entries in the routes.rb) but not  
for this one (matches) which I manually started to make. Scaffolding  
is nice but learn so much more from these mistakes doing it yourself  
that you helped me with . Thanks again.

---

<div class="post-metadata">

**Author:** ![rick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9f8e36/32.png) [@rick](https://www.ruby-forum.com/u/rick)\
**Post date:** [July 4, 2009, 3:44pm UTC](https://www.ruby-forum.com/t/im-stumped-by-this-stupid-newbie-error-im-seeing-trying-to-figure-out-where-to-look-next/171529/6 "2009-07-04T15:44:03Z")

</div>

> map.resources :name\_of\_controller, ‘/route’

Correcting the first entry - don’t know how that copy and paste got in  
there:

map.resources :name\_of\_controller, :only =\> :index
