Forum: Ruby on Rails nested resource routes with members

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.
Jonathan L. (Guest)
on 2007-06-03 11:57
(Received via mailing list)

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 topic is locked and can not be replied to.