Nested resource routes with members


lets say I have a Project that can have many Pages

Pages are acts_as_list so I have extra actions to move one “higher”
or “lower” in the list

I have this in routes.rb

map.resources :pages,
:member => { :higher => :put,
:lower => :put }

map.resources :projects do |project|
project.resources :pages, :name_prefix => “project_” # /projects/

this works fine for all except the member ones
for example, I can edit a page with GET /projects/99/pages/123/edit

but when i do PUT /projects/99/pages/123/higher
I get “no route found”

I get no method on: project_higher_page_path(“99”,“123”)
although this is fine: project_edit_page_path(“99”,“123”)

PS I am using Edge but not using the new routes resources. If this
can be solved with that, i’d be happy to know how to do it that way.



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