Get a habit to restart your development server after each change in routes.rb. And in models. Actually, I'm restarting the server a lot more times, than I probably should. But it's better than fight with silly bugs which are not even exist.
On Mon, May 10, 2010 at 12:39 AM, mattn <[email protected]> wrote: > I'm just getting started with Rails 2. Plus, it's been a while since I > played with Rails at all. So to explore, I whipped out an old Rails > tutorial (from an O'Reilly book) and started going through it, to > refresh my memory. This is just a simple "Hello world" experiment. > > I created my rails app, cd'd into it, started the server, and created > a simple controller: > > script/generate controller greeting > > So I tried to talk my controller in the browser: > > http://localhost:3000/greeting > > And I got a routing error, "no route matches ... with method get". > > I found this a bit hard to understand, because routes.db has the > default routes, so my controller name should work from a GET request. > But, nothing daunted, I added some overkill routing at the top of > routes.db: > > map.resources :greeting > > Now http://localhost:3000/greeting was routed properly; of course > there was no index action but now at least I got the expected error > message telling me so, I wrote an index method, and all was well; > hello, world. > > But here's the weird part. I then *deleted* the map.resources line > from routes.db, and my app nevertheless continued working. I can rake > routes and sure enough only the default routes are in force. So it > looks like maybe this a bug in Rails, where it takes some manual > jiggering to get the default routes operating properly? Anyway I > figure this must be well known, so maybe someone could just explain it > to me? No big deal, but I like to understand what's going on, if > possible - thx - m. > > -- > 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. > > -- 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.

