RichardOnRails
2010-Mar-02 13:30 UTC
"generate scaffold" generated plural name in routes.rb -- why?
Hi, I ran: http://localhost:3000/ I got: Routing Error No route matches "/" with {:method=>:get} I had just run: ruby script/generate scaffold vendor nickname:string qbname:string rename public\index.html to --index.html I listed Config\routes.rb: ActionController::Routing::Routes.draw do |map| map.resources :vendors I thought the plural "vendors" was odd, so I changed it to singular: app ran fine. Why did the plural version get generated? I''m running Rails 2.3.5 on WinXP-Pro/SP3 Thanks in Advance Richard -- 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.
Jeremy Chase
2010-Mar-02 13:38 UTC
Re: "generate scaffold" generated plural name in routes.rb -- why?
When mapping resources you use the pluralized version, so you need to switch it back to vendors. You also need to map the root, other wise localhost:3000/ will not have a route defined. See this commented line in routes.rb # You can have the root of your site routed with map.root -- just remember to delete public/index.html. # map.root :controller => "welcome" -Jer On Tue, Mar 2, 2010 at 8:30 AM, RichardOnRails < RichardDummyMailbox58407-gP6xRNRnnqSxhq/XJNNIW0EOCMrvLtNR@public.gmane.org> wrote:> Hi, > > I ran: > http://localhost:3000/ > I got: > Routing Error > No route matches "/" with {:method=>:get} > > I had just run: > ruby script/generate scaffold vendor nickname:string > qbname:string > rename public\index.html to --index.html > > I listed Config\routes.rb: > ActionController::Routing::Routes.draw do |map| > map.resources :vendors > > I thought the plural "vendors" was odd, so I changed it to singular: > app ran fine. > > Why did the plural version get generated? I''m running Rails 2.3.5 on > WinXP-Pro/SP3 > > Thanks in Advance > Richard > > -- > 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.
RichardOnRails
2010-Mar-02 17:47 UTC
Re: "generate scaffold" generated plural name in routes.rb -- why?
Thanks for your response Jeremy, Here''s what I know now. With http://localhost:3000/ and the 2nd line of routes.db successively: map.root :controller => "vendors" # undefined method `vendor_path'' map.root :controller => "users" # Works map.resources :users # No route matches "/" with {:method=>:get} map.resources :vendors # No route matches "/" with {:method=>:get} Also, the following both work, seemingly regardless of what routes are available http://localhost:3000/users http://localhost:3000/vendors My next effort is to add a Home page with a side-bar of links to other pages and kill all the root/resource entries except Home itself as the default. Yet I wonder why controller => "vendors" fails despite the fact that controller => "users" work, when I thing I created them in the same manner. Do you have any idea? I expect there''s not enough info to let anyone to make a useful guess, so I''ll just keep working to eliminate the need for routes to vendors and users, Again, thanks for your insights, Richard On Mar 2, 8:38 am, Jeremy Chase <jeremych...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> When mapping resources you use the pluralized version, so you need to switch > it back to vendors. You also need to map the root, other wise > localhost:3000/ will not have a route defined. See this commented line in > routes.rb > > # You can have the root of your site routed with map.root -- just remember > to delete public/index.html. > # map.root :controller => "welcome" > > -Jer > > On Tue, Mar 2, 2010 at 8:30 AM, RichardOnRails < > > RichardDummyMailbox58...-gP6xRNRnnqSxhq/XJNNIW0EOCMrvLtNR@public.gmane.org> wrote: > > Hi, > > > I ran: > > http://localhost:3000/ > > I got: > > Routing Error > > No route matches "/" with {:method=>:get} > > > I had just run: > > ruby script/generate scaffold vendor nickname:string > > qbname:string > > rename public\index.html to --index.html > > > I listed Config\routes.rb: > > ActionController::Routing::Routes.draw do |map| > > map.resources :vendors > > > I thought the plural "vendors" was odd, so I changed it to singular: > > app ran fine. > > > Why did the plural version get generated? I''m running Rails 2.3.5 on > > WinXP-Pro/SP3 > > > Thanks in Advance > > Richard > > > -- > > 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.