aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2012-07-20 10:50:38 +0100
committerAndrew White <andyw@pixeltrix.co.uk>2012-07-20 10:50:38 +0100
commitcabb4471afd51968121f6a94b4b161183fc223aa (patch)
treedfcf43aaa1e047c80e56c0a0522cff5aec7a69ba /actionpack/lib/action_dispatch
parent27619e34d42183f24c80648ee7a46b7fee348327 (diff)
downloadrails-cabb4471afd51968121f6a94b4b161183fc223aa.tar.gz
rails-cabb4471afd51968121f6a94b4b161183fc223aa.tar.bz2
rails-cabb4471afd51968121f6a94b4b161183fc223aa.zip
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.
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb4
1 files changed, 3 insertions, 1 deletions
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