aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/mapper.rb
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-04-11 04:39:25 -0300
committerJosé Valim <jose.valim@gmail.com>2010-04-11 12:05:43 +0200
commit5b89fd07b28bcd342f874ab08a03efd864db1340 (patch)
tree54a550be597446a59e61eb74b8f67ebf531df438 /actionpack/lib/action_dispatch/routing/mapper.rb
parent6d29f9789e9a7211ec2890f46caf6cb2e5530bbe (diff)
downloadrails-5b89fd07b28bcd342f874ab08a03efd864db1340.tar.gz
rails-5b89fd07b28bcd342f874ab08a03efd864db1340.tar.bz2
rails-5b89fd07b28bcd342f874ab08a03efd864db1340.zip
Make namespace work with options[:to] [#4351 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 7035e360ec..3e15caee2d 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -55,6 +55,14 @@ module ActionDispatch
path = args.first
end
+ if @scope[:module] && options[:to]
+ if options[:to].to_s.include?("#")
+ options[:to] = "#{@scope[:module]}/#{options[:to]}"
+ elsif @scope[:controller].nil?
+ options[:to] = "#{@scope[:module]}##{options[:to]}"
+ end
+ end
+
path = normalize_path(path)
if using_match_shorthand?(path, options)