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? -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 7 August 2010 19:45, Carl Jenkins <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 On Sat, Aug 7, 2010 at 2:34 PM, Chris Mear <chrismear-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 7 August 2010 19:45, Carl Jenkins <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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. http://fairleads.blogspot.com/2007/12/rails-20-and-scaffolding-step-by-step.html 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. -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.