Hi,

I am looking at the source code of resource.rb and have a question for
the code below:

===========Ruby script resource.rb =======================
map.named_route("#{action}_#{resource.name_prefix}#{resource.singular}",
"#{resource.member_path}#{resource.action_separator}#{action}",
action_options)
map.connect("#{resource.member_path};#{action}", action_options)
map.connect("#{resource.member_path}.:format;#{action}", action_options)
map.named_route("formatted_#{action}_#{resource.name_prefix}#{resource.singular}",
"#{resource.member_path}#{resource.action_separator}#{action}.:format",
action_options)
============Ruby script resource.rb=======================

In my understanding, there would be four routes generated by method
named_route and connect.

So, here comes the question: How can rails identify the correct route in
the four? and why put four routes in the hash table?

I roughly read other part of the code:
==================Ruby script  routing.rb==========================
routes = routes_by_controller[controller][action][options.keys.sort_by {
|x| x.object_id }]

routes.each do |route|
       results = route.send(method, options, merged, expire_on)
       return results if results && (!results.is_a?(Array) ||
results.first)
end
===================Ruby script  routing.rb===========================

It seems that the "routes" can be retrieved from Hash table and the
first route in the hash table would be the route be selected.

Thanks for your time and any comments!

HaiJun
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Deploying Rails" group.
To post to this group, send email to rubyonrails-deployment@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-deployment?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to