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?
–
Jochen