map.resources :cars, :has_one => :driver
You're probably expecting to use form_for like this:
form_for([@car, @driver])
That won't work. It'll complain about not being able to find the function, 'car_drivers_path' instead of 'car_driver_path'
Fix:
form_for(@driver, :url => car_driver_path(@car))
Hopefully in Rails 2.1.1 this will be fixed using a different, less crazy syntax:
http://rails.lighthouseapp.com/projects/8994/tickets/461-fixed-polymorphic_url-to-be-able-to-handle-singleton-resources
That is all.
6 comments:
Good Post, it's help me!
Thansks!
Thanks.
Works good, thanks
This seems still the case for rails 2.3.2 actually with your post your probably saved my life!!! :-) thank you
Thank you for this post, seems to still be problem ... without your wise words and clearly explained solution I'd likely be up for a while longer trying to figure this out!
Thanks! Wish this was in the Rails docs...
Post a Comment