1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionpack/lib/action_dispatch/routing
Seb Jacobs e972d34120 Generate shallow paths for all children of shallow resources.
Prior to this commit shallow resources would only generate paths for
non-direct children (with a nested depth greater than 1).

Take the following routes file.

    resources :blogs do
      resources :posts, shallow: true do
        resources :comments do
          resources :tags
        end
      end
    end

This would generate shallow paths for `tags` nested under `posts`,
e.g `/posts/:id/tags/`, however it would not generate shallow paths
for `comments` nested under `posts`, e.g `/posts/:id/comments/new`.

This commit changes the behaviour of the route mapper so that it
generate paths for direct children of shallow resources, for example
if you take the previous routes file, this will now generate
shallow paths for `comments` nested under `posts`, .e.g
`posts/:id/comments/new`.

This was the behaviour in Rails `4.0.4` however this was broken in
@jcoglan's fix for another routes related issue[1].

This also fixes an issue[2] reported by @smdern.

[1] https://github.com/rails/rails/commit/d0e5963
[2] https://github.com/rails/rails/issues/15783
2014-07-06 08:52:32 +01:00
..
endpoint.rb give all endpoints a superclass 2014-05-27 12:10:24 -07:00
inspector.rb we do not need to cache rack_app 2014-05-26 15:43:14 -07:00
mapper.rb Generate shallow paths for all children of shallow resources. 2014-07-06 08:52:32 +01:00
polymorphic_routes.rb Simplify merge call on polymorphic helpers 2014-05-13 08:18:07 -03:00
redirection.rb remove another wasteful AS::SafeBuffer allocation 2014-06-06 12:06:58 -07:00
route_set.rb Remove unused param 'separators' from RouteSet#build_path 2014-06-15 22:01:34 +03:00
routes_proxy.rb Missing or unneeded require extract_options 2013-02-01 12:10:58 +09:00
url_for.rb use the helper method builder to construct helper methods 2014-05-12 15:54:45 -07:00