From e09e600a48e525553767da5a1ec2e756fe62aac4 Mon Sep 17 00:00:00 2001 From: Dylan Waits Date: Sat, 2 Apr 2016 18:38:22 -0700 Subject: Honor shallow: false on nested resources Previously there was no way to place a non-shallow resource inside a parent with `shallow: true` set. Now you can set `shallow: false` on a nested child resource to generate normal (non-shallow) routes for it. Fixes #23890. --- actionpack/lib/action_dispatch/routing/mapper.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 16b430c36e..81ffea4d5d 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1362,6 +1362,8 @@ module ActionDispatch # as a comment on a blog post like /posts/a-long-permalink/comments/1234 # to be shortened to just /comments/1234. # + # Set shallow: false on a child resource to ignore a parent's shallow parameter. + # # [:shallow_path] # Prefixes nested shallow routes with the specified path. # @@ -1724,7 +1726,8 @@ to this: return true end - if options.delete(:shallow) + if options[:shallow] + options.delete(:shallow) shallow do send(method, resources.pop, options, &block) end -- cgit v1.2.3