# Problem with routes

**URL:** <https://www.ruby-forum.com/t/problem-with-routes/160242>\
**Category:** Rails\
**Created:** [February 13, 2009, 10:58am UTC](https://www.ruby-forum.com/t/problem-with-routes/160242 "2009-02-13T10:58:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![remco\_h](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/977dab/32.png) [@remco\_h](https://www.ruby-forum.com/u/remco_h)\
**Post date:** [February 13, 2009, 10:58am UTC](https://www.ruby-forum.com/t/problem-with-routes/160242/1 "2009-02-13T10:58:59Z")

</div>

Hi, i am lost with routes  
I have restfull controllers with a few non-crud actions and i did this:

ActionController::Routing::Routes.draw do |map|

# Restful Authentication Rewrites

map.resources :patienten  
map.resources :prestaties  
map.patienten “patienten/selected”, :controller=\>:patienten,  
:action=\>:toggle\_selected  
map.prestaties “prestaties/selected”, :controller=\>:prestaties,  
:action=\>:toggle\_selected

# Install the default routes as the lowest priority.

map.connect ‘:controller/:action/:id’  
map.connect ‘:controller/:action/:id.:format’  
map.connect ‘:controller/:action’  
end

now if i do rake routes i get the following output:

```
               GET /patienten

```

{:controller=\>“patienten”, :action=\>“index”}  
formatted\_patienten GET /patienten.:format  
{:controller=\>“patienten”, :action=\>“index”}  
POST /patienten  
{:controller=\>“patienten”, :action=\>“create”}  
POST /patienten.:format  
{:controller=\>“patienten”, :action=\>“create”}  
new\_patient GET /patienten/new  
{:controller=\>“patienten”, :action=\>“new”}  
formatted\_new\_patient GET /patienten/new.:format  
{:controller=\>“patienten”, :action=\>“new”}  
edit\_patient GET /patienten/:id/edit  
{:controller=\>“patienten”, :action=\>“edit”}  
formatted\_edit\_patient GET /patienten/:id/edit.:format  
{:controller=\>“patienten”, :action=\>“edit”}  
patient GET /patienten/:id  
{:controller=\>“patienten”, :action=\>“show”}  
formatted\_patient GET /patienten/:id.:format  
{:controller=\>“patienten”, :action=\>“show”}  
PUT /patienten/:id  
{:controller=\>“patienten”, :action=\>“update”}  
PUT /patienten/:id.:format  
{:controller=\>“patienten”, :action=\>“update”}  
DELETE /patienten/:id  
{:controller=\>“patienten”, :action=\>“destroy”}  
DELETE /patienten/:id.:format  
{:controller=\>“patienten”, :action=\>“destroy”}  
GET /prestaties  
{:controller=\>“prestaties”, :action=\>“index”}  
formatted\_prestaties GET /prestaties.:format  
{:controller=\>“prestaties”, :action=\>“index”}  
POST /prestaties  
{:controller=\>“prestaties”, :action=\>“create”}  
POST /prestaties.:format  
{:controller=\>“prestaties”, :action=\>“create”}  
new\_prestatie GET /prestaties/new  
{:controller=\>“prestaties”, :action=\>“new”}  
formatted\_new\_prestatie GET /prestaties/new.:format  
{:controller=\>“prestaties”, :action=\>“new”}  
edit\_prestatie GET /prestaties/:id/edit  
{:controller=\>“prestaties”, :action=\>“edit”}  
formatted\_edit\_prestatie GET /prestaties/:id/edit.:format  
{:controller=\>“prestaties”, :action=\>“edit”}  
prestatie GET /prestaties/:id  
{:controller=\>“prestaties”, :action=\>“show”}  
formatted\_prestatie GET /prestaties/:id.:format  
{:controller=\>“prestaties”, :action=\>“show”}  
PUT /prestaties/:id  
{:controller=\>“prestaties”, :action=\>“update”}  
PUT /prestaties/:id.:format  
{:controller=\>“prestaties”, :action=\>“update”}  
DELETE /prestaties/:id  
{:controller=\>“prestaties”, :action=\>“destroy”}  
DELETE /prestaties/:id.:format  
{:controller=\>“prestaties”, :action=\>“destroy”}  
patienten /patienten/selected  
{:controller=\>:patienten, :action=\>:toggle\_selected}  
prestaties /prestaties/selected  
{:controller=\>:prestaties, :action=\>:toggle\_selected}  
/:controller/:action/:id  
/:controller/:action/:id.:format  
/:controller/:action

the strange thing (for me) is that the “prestaties” and “patienten”  
methods are connected to the last routes in the list, so

patienten\_url gives me /patienten/selected instead of /patienten.  
i thought priorities go top-down, so why are the methods connected to  
the lowest routes?
