controller methods and how I learned to love 'rake routes'

Face it: to the newcomer, Rails routing is strange and mysterious. It took me a while get the hang of it, so I thought I'd share some info (and a couple of handy techniques) for those who are new to Rails.

Here, assume we have Users and Reports, and that one User "has many" Reports. Normally, that will be expressed in your model files (but that's another topic!) -- but right now we're focused on making an entry in config/routes.rb to express how incoming URLs map to your controllers.

In this example, we're using RESTful routing to create "shallow nested routes" to express that a User :has_many Reports. So we create an entry in config/routes.rb like this:

====== config/routes.rb:   map.resources :users, :has_many => :reports, :shallow => true