Hi, I have bumped into a weird case that almost seems like a bug or.. a total newbie mistake. After generating a controller with rails g controller store index I expected to get a page when accessing http://site:3000/store but instead I got No route matches "/store". config/routes.rb has got: get "store/index" and everything works when accessing http://site:3000/store/index Webrick restart did not help. $ ruby -v ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux] $ rails -v Rails 3.0.5 $ gem -v 1.6.2 -- 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 Mon, Mar 14, 2011 at 3:45 PM, Kivi <sonicmonkey-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I have bumped into a weird case that almost seems like a bug or.. a > total newbie mistake. > > After generating a controller with > > rails g controller store index > > I expected to get a page when accessing http://site:3000/store > > but instead I got No route matches "/store". > > config/routes.rb has got: get "store/index" >''get "store/index"'' all on its own won''t be a valid route. At the very least, I think you''d want something like: match "store" => "store#index" There are other ways to do it, but it depends what you''re trying to do. The routing guide (http://guides.rubyonrails.org/routing.html) is pretty thorough for most common routes.> > and everything works when accessing http://site:3000/store/index > > Webrick restart did not help. > > $ ruby -v > ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux] > > $ rails -v > Rails 3.0.5 > > $ gem -v > 1.6.2 > > -- > 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. > >-- 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.
Thank you. Indeed. I got it working by adding, as you also suggested, match ''store'' => ''store#index'', :via => :get to the routes file. I am working with Agile Web Development with Rails, 3rd edition. Version differences maybe. Kristjan On Mar 14, 11:03 pm, Phil Crissman <phil.criss...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mon, Mar 14, 2011 at 3:45 PM, Kivi <sonicmon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi, > > > I have bumped into a weird case that almost seems like a bug or.. a > > total newbie mistake. > > > After generating a controller with > > > rails g controller store index > > > I expected to get a page when accessinghttp://site:3000/store > > > but instead I got No route matches "/store". > > > config/routes.rb has got: get "store/index" > > ''get "store/index"'' all on its own won''t be a valid route. At the very > least, I think you''d want something like: > > match "store" => "store#index" > > There are other ways to do it, but it depends what you''re trying to do. The > routing guide (http://guides.rubyonrails.org/routing.html) is pretty > thorough for most common routes. > > > > > and everything works when accessinghttp://site:3000/store/index > > > Webrick restart did not help. > > > $ ruby -v > > ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux] > > > $ rails -v > > Rails 3.0.5 > > > $ gem -v > > 1.6.2 > > > -- > > 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.-- 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.
Walter Lee Davis
2011-Mar-15 15:18 UTC
Re: Re: Weird routing problem after generating controller
Get the fourth version, which is for Rails 3. The PDF is final, I believe, and the paper book should be shipping any day. (I keep watching the porch for the UPS guy...) Walter On Mar 14, 2011, at 5:23 PM, Kivi wrote:> I am working with Agile Web Development with > Rails, 3rd edition. Version differences maybe.-- 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.
I am really looking forward to the paper book to get out of beta status! :) K On Mar 15, 5:18 pm, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> Get the fourth version, which is for Rails 3. The PDF is final, I > believe, and the paper book should be shipping any day. (I keep > watching the porch for the UPS guy...) > > Walter > > On Mar 14, 2011, at 5:23 PM, Kivi wrote: > > > I am working with Agile Web Development with > > Rails, 3rd edition. Version differences maybe.-- 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.