<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -52,6 +52,10 @@ module ActionController
         @plural   ||= entities
         @singular ||= options[:singular] || plural.to_s.singularize
         @path_segment = options.delete(:as) || @plural
+        default = options.delete(:default)
+        if default.to_s == entities.to_s || default == true
+          @path_segment = nil
+        end
 
         @options = options
 
@@ -76,7 +80,7 @@ module ActionController
       end
 
       def path
-        @path ||= &quot;#{path_prefix}/#{path_segment}&quot;
+        @path ||= &quot;#{path_prefix}#{'/' if path_segment}#{path_segment}&quot;
       end
 
       def new_path
@@ -252,6 +256,8 @@ module ActionController
     #       # product_reviews_path(product) == '/productos/1234/comentarios'
     #       product.resources :product_reviews, :as =&gt; 'comentarios'
     #     end
+    # * &lt;tt&gt;:show&lt;/tt&gt; - Specifies a nested resource collection whose index action should *replace* this resource's show action.
+    # * &lt;tt&gt;:default&lt;/tt&gt; - When true, causes the resource to not generate a namespace prefix.
     #
     # * &lt;tt&gt;:has_one&lt;/tt&gt; - Specify nested resources, this is a shorthand for mapping singleton resources beneath the current.
     # * &lt;tt&gt;:has_many&lt;/tt&gt; - Same has &lt;tt&gt;:has_one&lt;/tt&gt;, but for plural resources.
@@ -438,8 +444,12 @@ module ActionController
           map_associations(resource, options)
 
           if block_given?
-            with_options(:path_prefix =&gt; resource.nesting_path_prefix, :name_prefix =&gt; resource.nesting_name_prefix, :namespace =&gt; options[:namespace], &amp;block)
+            nested_options = {:path_prefix =&gt; resource.nesting_path_prefix, :name_prefix =&gt; resource.nesting_name_prefix, :namespace =&gt; options[:namespace]}
+            nested_options[:default] = options[:show] if options[:show]
+            with_options(nested_options, &amp;block)
           end
+
+          map_low_priority_actions(map, resource)
         end
       end
 
@@ -533,9 +543,7 @@ module ActionController
           end
         end
 
-        show_action_options = action_options_for(&quot;show&quot;, resource)
-        map.named_route(&quot;#{resource.name_prefix}#{resource.singular}&quot;, resource.member_path, show_action_options)
-        map.named_route(&quot;formatted_#{resource.name_prefix}#{resource.singular}&quot;, &quot;#{resource.member_path}.:format&quot;, show_action_options)
+        map_member_get(map,resource) unless resource.options[:show]
 
         update_action_options = action_options_for(&quot;update&quot;, resource)
         map.connect(resource.member_path, update_action_options)
@@ -546,6 +554,16 @@ module ActionController
         map.connect(&quot;#{resource.member_path}.:format&quot;, destroy_action_options)
       end
 
+      def map_low_priority_actions(map, resource)
+        map_member_get(map,resource) if resource.options[:show]
+      end
+
+      def map_member_get(map, resource)
+        show_action_options = action_options_for(&quot;show&quot;, resource)
+        map.named_route(&quot;#{resource.name_prefix}#{resource.singular}&quot;, resource.member_path, show_action_options)
+        map.named_route(&quot;formatted_#{resource.name_prefix}#{resource.singular}&quot;, &quot;#{resource.member_path}.:format&quot;, show_action_options)
+      end
+
       def add_conditions_for(conditions, method)
         returning({:conditions =&gt; conditions.dup}) do |options|
           options[:conditions][:method] = method unless method == :any</diff>
      <filename>actionpack/lib/action_controller/resources.rb</filename>
    </modified>
    <modified>
      <diff>@@ -682,6 +682,51 @@ class ResourcesTest &lt; Test::Unit::TestCase
       assert_recognizes(expected_options, :path =&gt; 'thread/1.1.1/comments/1', :method =&gt; :get)
     end
   end
+  
+  def test_default_routing
+    expected_nested_member_get = {:controller =&gt; 'messages', :action =&gt; 'show', :thread_id =&gt; 'a-thread', :id =&gt; 'a-comment'}
+    expected_nested_collection_index = {:controller =&gt; 'threads', :action =&gt; 'show', :id =&gt; 'a-thread'}
+    with_routing do |set|
+      set.draw do |map|
+        map.resources :threads do |threads|
+          threads.resources :messages, :default =&gt; true
+        end
+      end
+      assert_recognizes(expected_nested_member_get, :path =&gt; 'threads/a-thread/a-comment', :method =&gt; :get)
+      assert_recognizes(expected_nested_collection_index, :path =&gt; 'threads/a-thread/', :method =&gt; :get)
+    end
+  end
+
+  def test_show_routing
+    expected_default_nested_member_show = {
+      :controller =&gt; 'messages', :action =&gt; 'show',
+      :thread_id =&gt; 'a-thread', :id =&gt; 'a-comment'
+    }
+    expected_default_nested_collection_index = {
+      :controller =&gt; 'messages', :action =&gt; 'index',
+      :thread_id =&gt; 'a-thread'
+    }
+    expected_normal_nested_member_show = {
+      :controller =&gt; 'authors', :action =&gt; 'show',
+      :thread_id =&gt; 'a-thread', :id =&gt; 'an-author'
+    }
+    expected_normal_nested_collection_index = {
+      :controller =&gt; 'authors', :action =&gt; 'index',
+      :thread_id =&gt; 'a-thread'
+    }
+    with_routing do |set|
+      set.draw do |map|
+        map.resources :threads, :show =&gt; :messages do |threads|
+          threads.resources :authors
+          threads.resources :messages
+        end
+      end
+      assert_recognizes(expected_default_nested_member_show, :path =&gt; 'threads/a-thread/a-comment', :method =&gt; :get)
+      assert_recognizes(expected_default_nested_collection_index, :path =&gt; 'threads/a-thread/', :method =&gt; :get)
+      assert_recognizes(expected_normal_nested_member_show, :path =&gt; 'threads/a-thread/authors/an-author', :method =&gt; :get)
+      assert_recognizes(expected_normal_nested_collection_index, :path =&gt; 'threads/a-thread/authors', :method =&gt; :get)
+    end
+  end
 
   protected
     def with_restful_routing(*args)</diff>
      <filename>actionpack/test/controller/resources_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f31651bd6ac8c3d887a43ee8f71ed7a9bc7877cb</id>
    </parent>
  </parents>
  <author>
    <name>Chris Eppstein</name>
    <email>chris@eppsteins.net</email>
  </author>
  <url>http://github.com/chriseppstein/rails/commit/ea9be5989b5eb4465d9e057f2d7b77a9a7292e50</url>
  <id>ea9be5989b5eb4465d9e057f2d7b77a9a7292e50</id>
  <committed-date>2008-06-16T21:37:19-07:00</committed-date>
  <authored-date>2008-06-16T18:59:58-07:00</authored-date>
  <message>Default Routing

This is an Search Engine Optimization enabling change that allows you to specify that one or more nested routes will not have
a path segment added to their url.  When combined with pretty urls, this results in nice tight urls without any redundant
folders in them in the cases where the nesting resource member is primarily a container for a collection of nested resources.

This plugin adds new new routing options:
* :default - When true, causes the resource to not generate a namespace prefix
* :show - a symbol identifying a nested resource whose index action should *replace* this resources show action.

It's important to note that using a :default nesting results in a url collision that hides the index action of the nested
resource. If routing to the index action is more desirable, use the :show option on the parent resource instead.

Example
=======

map.namespace :forum do |forum|
  forum.resources :boards, :default =&gt; true, :show =&gt; :threads do |boards|
    boards.resources :threads, :show =&gt; posts do |threads|
      threads.resources :posts
    end
  end
end

% rake routes | grep forum | grep -v format

                forum_boards GET    /forum
                             POST   /forum
             new_forum_board GET    /forum/new
            edit_forum_board GET    /forum/:id/edit
                             PUT    /forum/:id
                             DELETE /forum/:id
         forum_board_threads GET    /forum/:board_id             # prevents recognition of forum_board
                             POST   /forum/:board_id
      new_forum_board_thread GET    /forum/:board_id/new
     edit_forum_board_thread GET    /forum/:board_id/:id/edit
                             PUT    /forum/:board_id/:id
                             DELETE /forum/:board_id/:id
    forum_board_thread_posts GET    /forum/:board_id/:thread_id  # prevents recognition of forum_board_thread
                             POST   /forum/:board_id/:thread_id
 new_forum_board_thread_post GET    /forum/:board_id/:thread_id/new
edit_forum_board_thread_post GET    /forum/:board_id/:thread_id/:id/edit
     forum_board_thread_post GET    /forum/:board_id/:thread_id/:id
                             PUT    /forum/:board_id/:thread_id/:id
                             DELETE /forum/:board_id/:thread_id/:id
          forum_board_thread GET    /forum/:board_id/:id
                 forum_board GET    /forum/:id

% script/console
&gt;&gt; app.forum_board_thread_post_path(Board.first, Thread.first, Post.first)
=&gt; &quot;/forum/star-wars/droids/r2d2-rocks-c3po-sucks&quot;

Copyright (c) 2008 Chris Eppstein, released under the MIT license</message>
  <tree>545ca9f78948664e05b2f8bb7c52ba294df290a7</tree>
  <committer>
    <name>Chris Eppstein</name>
    <email>chris@eppsteins.net</email>
  </committer>
</commit>
