:id constraints with nested resources

Hi,

I have the following routes in my Rails 3 app:

  resources :lists, :id => /([A-Za-z0-9]{25})|default/ do
    resources :todos, :id => /\d+/
  end

rake routes outputs:
              list_todos GET /lists/:list_id/
todos(.:format) {:list_id=>/\d
+/, :action=>"index", :controller=>"todos"}
           new_list_todo GET /lists/:list_id/todos/
new(.:format) {:list_id=>/\d
+/, :action=>"new", :controller=>"todos"}
               list_todo GET /lists/:list_id/
todos/:id(.:format) {:id=>/\d+/, :list_id=>/\d
+/, :action=>"show", :controller=>"todos"}
               edit_list GET /lists/:id/
edit(.:format) {:id=>/([A-Za-z0-9]{25})|
default/, :action=>"edit", :controller=>"lists"}
                    list GET /
lists/:id(.:format) {:id=>/([A-Za-z0-9]{25})|
default/, :action=>"show", :controller=>"lists"}

:list_id for the nested resource simply can't be right?

I tracked it down to nested_options in mapper.rb
              options[:constraints] = { "#{parent_resource.singular}
_id".to_sym => id_constraint } if id_constraint?

In my eyes this doesn't make sense. Is there a way to get the
id_constraint of the parent_resource?

Cheers,
Martin

Martin, yes it appears there's a bug here. Can you please create a ticket.

As a workaround if you spec the routes in full it works as expected:

  resources :lists, :constraints => { :id => /([A-Za-z0-9]{25})|default/ } do
    nested do
      resources :todos, :constraints => { :id => /\d+/ }
    end
  end

Andrew