map.resources and link confusion

I have:

class Booking < ActiveRecord::Base
   belongs_to :guest
end
  
class Guest < ActiveRecord::Base
   has_many :bookings
end

map.resources :guests, :has_many => [:bookings]

bookings_comtroller:

before_filter :load_user

def load_user
  @guest = Guest.find(params[:guest_id])
end

So I can do something like:

http://127.0.0.1:3000/guests/5/bookings/9

...works fine.

But now

http://127.0.0.1:3000/bookings

does not work any longer!

ActiveRecord::RecordNotFound in BookingsController#index
Couldn't find Guest without an ID

What am I missing?

That's because u have defined nested routes and it will not handle
that URL. It needs the parent id. Do rake routes to get the list of
URL helper methods. U need to define route that will handle it.