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:
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
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;
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.