Forum: Ruby on Rails nested resource routes with members

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cd804cfeeea508f6bf2f5487c9ef4aed?d=identicon&s=25 Jonathan Linowes (Guest)
on 2007-06-03 09:57
(Received via mailing list)
hi,

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/
X/pages/Y
   end


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.

tia

linoj
This topic is locked and can not be replied to.