URL for creating nested resources in REST

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
end

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,
Jon

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs