# Url routing issue - Agile Rails Chapter 6

**URL:** <https://www.ruby-forum.com/t/url-routing-issue-agile-rails-chapter-6/192892>\
**Category:** Rails\
**Created:** [August 7, 2010, 8:45pm UTC](https://www.ruby-forum.com/t/url-routing-issue-agile-rails-chapter-6/192892 "2010-08-07T20:45:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cjnkns](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c5a1d2/32.png) [@cjnkns](https://www.ruby-forum.com/u/cjnkns)\
**Post date:** [August 7, 2010, 8:45pm UTC](https://www.ruby-forum.com/t/url-routing-issue-agile-rails-chapter-6/192892/1 "2010-08-07T20:45:25Z")

</div>

I am walking through the tutorial in Agile web development with rails  
book 3rd edition.

When I try to access the url [http://localhost:3000/products](http://localhost:3000/products) I get this  
error

No route matches “/products” with {:method=\>:get}

Which - when I look at the products controller I do not understand how  
the url in the book is correct?

In the previous chapter I created a Say controller which had a hello  
action. But, the products controller has index, show, new, edit, create,  
update and destroy.

I tried /products/new and products/index and still nothing…

What am I missing here?

---

<div class="post-metadata">

**Author:** ![cjnkns](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c5a1d2/32.png) [@cjnkns](https://www.ruby-forum.com/u/cjnkns)\
**Post date:** [August 7, 2010, 9:35pm UTC](https://www.ruby-forum.com/t/url-routing-issue-agile-rails-chapter-6/192892/2 "2010-08-07T21:35:38Z")

</div>

On 7 August 2010 19:45, Carl J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> In the previous chapter I created a Say controller which had a hello  
> action. But, the products controller has index, show, new, edit, create,  
> update and destroy.
> 
> I tried /products/new and products/index and still nothing…
> 
> What am I missing here?

The ‘No route matches…’ error usually suggests that something is  
missing in your config/routes.rb file. At this point in the tutorial,  
you should have:

map.resources :products

somewhere in your config/routes.rb. Do you?

( This is a bit hard to diagnose, as you’ve noticed, because the  
‘resource’-style routing adds some standard mappings that aren’t like  
the explicit /controller/action mapping you were previously introduced  
to. In this case, behind the scenes, the ‘map.resources :products’  
adds a route that maps /products to ProductsController#index. You can  
read more about this in the Rails Routing guide [1]. It seems weird  
and magical at first, but it’ll soon become second nature, trust me! )

Chris

[1]

> **[Rails Routing from the Outside In — Ruby on Rails Guides](https://guides.rubyonrails.org/routing.html#restful-routing-the-rails-default)**
>
> Rails Routing from the Outside InThis guide covers the user-facing features of Rails routing.After reading this guide, you will know: How to interpret the code in config/routes.rb. How to construct your own routes, using either the preferred...

---

<div class="post-metadata">

**Author:** ![cjnkns](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c5a1d2/32.png) [@cjnkns](https://www.ruby-forum.com/u/cjnkns)\
**Post date:** [August 7, 2010, 9:47pm UTC](https://www.ruby-forum.com/t/url-routing-issue-agile-rails-chapter-6/192892/3 "2010-08-07T21:47:56Z")

</div>

Use

rake routes

from any directory in your Rails app to list your routes. I’ve found it  
a  
big help, especially for understanding what’s going on behind the  
scenes.

Fred

---

<div class="post-metadata">

**Author:** ![cjnkns](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c5a1d2/32.png) [@cjnkns](https://www.ruby-forum.com/u/cjnkns)\
**Post date:** [August 7, 2010, 9:53pm UTC](https://www.ruby-forum.com/t/url-routing-issue-agile-rails-chapter-6/192892/4 "2010-08-07T21:53:13Z")

</div>

Thanks for the responses but, I found the issue.

I am really new to this (obviously) but, I think I had started Webrcik  
in my demo directory and not the depot on which it should have been.

Another thing is that I found this website.

> **[Rails 2.0 and Scaffolding Step by Step](http://fairleads.blogspot.com/2007/12/rails-20-and-scaffolding-step-by-step.html)**
>
> Rails 2.0 step by step. Part 2 is here Ruby on Rails 2.0 was released by the Rails core team on Friday, December 7th . There were quite a fe...

That shows using script/generate without a ‘/’ in the command. The book  
uses this and it was causing an issue trying to run db:migrate. My  
migration file had a space between the ‘:’ colon and the column name.

Once I fixed those things I can now get to the url just fine.

Trying to figure out the differences is a pain. The book says it is for  
Rails 2 and I am running Rails 2.3.8 you’d think this would be a  
no-brainer.
