On 7 August 2010 19:45, Carl Jenkins <[email protected]> wrote:
> 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 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?

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] http://guides.rubyonrails.org/routing.html#restful-routing-the-rails-default

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to