## routes_doubt

hi. as an experiment i decide to: rake routes , considering my routes.rb file has only: map.resources users. well, we all know the output, but based on this output the last 3 mappings which are: show(get), update(put) and destroy(delete):

user GET /users/:id {:action=>”show”, :controller=>”users”}
PUT /users/:id {:action=>”update”, :controller=>”users”}
DELETE /users/:id {:action=>”destroy”, :controller=>”users”}

based on the output above i decided to write the equivalent routes in the routes.rb file in order to mimic what map.resources does. so we will have 7 routes. to simplify let’s just consider here these last 3 routes. first, based on the output above, my conclusion is that i could use 3 routes with the same name: map.user and differentiate then with the :method symbol, being get, put and delete for each one of them … so rails would know which one to use based on the :method

map.user ‘users/:id’, … , :method => :get
map.user ‘users/:id’, … , :method => ut
map.user ‘users/:id’, … , :method => :delete

well, that doesn’t work … if i click delete in the view then the show action will be triggered. my 2nd conclusion is that since i’m not using map.resources and instead i’m using named_routes, then the routing system will use the top-first rule

my doubt is, how rails understand map.resources since the output from rake routes doesn’t imply us to do something like:

map.user_show ‘users/:id’, … , :method => :get
map.user_update ‘users/:id’, … , :method => ut
map.user_delete ‘users/:id’, … , :method => :delete

plus if i named_route like the sample above, i don’t need to specify which method to use, cause the routes are named. right?

then my 3rd conclusion is that rails should understand:

map.user ‘users/:id’, … , :method => :get
map.user ‘users/:id’, … , :method => ut
map.user ‘users/:id’, … , :method => :delete

based on the :method differentiation. i also did: :requirements => {:method => :delete} in routes.rb or user_path(user) in my view, but no success.