diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2012-07-20 10:50:38 +0100 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2012-07-20 10:50:38 +0100 |
commit | cabb4471afd51968121f6a94b4b161183fc223aa (patch) | |
tree | dfcf43aaa1e047c80e56c0a0522cff5aec7a69ba /actionpack/lib/action_dispatch | |
parent | 27619e34d42183f24c80648ee7a46b7fee348327 (diff) | |
download | rails-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.rb | 4 |
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 |