From cabb4471afd51968121f6a94b4b161183fc223aa Mon Sep 17 00:00:00 2001
From: Andrew White <andyw@pixeltrix.co.uk>
Date: Fri, 20 Jul 2012 10:50:38 +0100
Subject: Don't assume resource param is :id when using shallow routes

Since #5581 added support for resources with custom params we should
not assume that it is :id when using shallow resource routing.
---
 actionpack/lib/action_dispatch/routing/mapper.rb | 4 +++-
 1 file changed, 3 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 7f8257a063..0a65b4dbcc 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -965,6 +965,8 @@ module ActionDispatch
             "#{path}/:#{param}"
           end
 
+          alias :shallow_scope :member_scope
+
           def new_scope(new_path)
             "#{path}/#{new_path}"
           end
@@ -1509,7 +1511,7 @@ module ActionDispatch
 
           def path_for_action(action, path) #:nodoc:
             prefix = shallow_scoping? ?
-              "#{@scope[:shallow_path]}/#{parent_resource.path}/:id" : @scope[:path]
+              "#{@scope[:shallow_path]}/#{parent_resource.shallow_scope}" : @scope[:path]
 
             if canonical_action?(action, path.blank?)
               prefix.to_s
-- 
cgit v1.2.3