aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-01-10 18:42:45 +0100
committerJosé Valim <jose.valim@gmail.com>2010-01-10 18:42:45 +0100
commit8d72ba51bac75e44ca86fafbcab54eab7a355d29 (patch)
treeee8f6f0d8b7e52f70634b5302f28f52de1a3462e /actionpack/lib
parent36969c6ecd69fc285bf0267805152319a4b71ceb (diff)
downloadrails-8d72ba51bac75e44ca86fafbcab54eab7a355d29.tar.gz
rails-8d72ba51bac75e44ca86fafbcab54eab7a355d29.tar.bz2
rails-8d72ba51bac75e44ca86fafbcab54eab7a355d29.zip
Ensure nested namespaces work as expected.
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb11
1 files changed, 4 insertions, 7 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 00659c8bd4..f7fb4ddd7a 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -77,7 +77,6 @@ module ActionDispatch
path
end
-
def app
Constraints.new(
to.respond_to?(:call) ? to : Routing::RouteSet::Dispatcher.new(:defaults => defaults),
@@ -123,7 +122,6 @@ module ActionDispatch
end
end
-
def blocks
if @options[:constraints].present? && !@options[:constraints].is_a?(Hash)
block = @options[:constraints]
@@ -258,17 +256,17 @@ module ActionDispatch
else
name_prefix_set = false
end
-
+
if namespace = options.delete(:namespace)
namespace_set = true
- namespace, @scope[:namespace] = @scope[:namespace], namespace
+ namespace, @scope[:namespace] = @scope[:namespace], (@scope[:namespace] ? "#{@scope[:namespace]}/#{namespace}" : namespace)
else
namespace_set = false
end
if controller = options.delete(:controller)
controller_set = true
- controller, @scope[:controller] = @scope[:controller], @scope[:namespace] ? "#{@scope[:namespace]}/#{controller}" : controller
+ controller, @scope[:controller] = @scope[:controller], (@scope[:namespace] ? "#{@scope[:namespace]}/#{controller}" : controller)
else
controller_set = false
end
@@ -277,13 +275,12 @@ module ActionDispatch
unless constraints.is_a?(Hash)
block, constraints = constraints, {}
end
+
constraints, @scope[:constraints] = @scope[:constraints], (@scope[:constraints] || {}).merge(constraints)
blocks, @scope[:blocks] = @scope[:blocks], (@scope[:blocks] || []) + [block]
-
options, @scope[:options] = @scope[:options], (@scope[:options] || {}).merge(options)
yield
-
self
ensure
@scope[:path] = path if path_set