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.
Sent from my iPhone
On Dec 19, 2007, at 2:02 PM, Jochen Kaechelin
<gissmoh-Vg5pTm5GbeLoK6nBLMlh1Q@public.gmane.org>
wrote:
>
> 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
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---