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?
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to