Forum: Ruby on Rails URL for creating nested resources in REST

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
476d2a42689da3bd46375955fda053df?d=identicon&s=25 namelessjon (Guest)
on 2007-04-22 23:40
(Received via mailing list)
Hi all

I have a problem with the url helpers my nested routes are supplying
(or at least, I think I do).  I'm writing a site to help people keep
track of roleplaying characters, so one user has_many characters, so
in routes.rb I have the arrangement like so:

map.resources :user do |user|
    user.resources :character

user_path(user_id) works fine for all the REST actions I need for
users, except for POST.

Likewise, character_path(user_id,character_id) works for GET, PUT, and
DELETE for all the usual REST actions.

And manually typing in urls like /user and /user/1/character work for
POST, but I'm sure there should be url helpers for them...

Any pointers would be gratefully appreciated,
This topic is locked and can not be replied to.