aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-02-24 01:38:10 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-02-24 01:38:10 +0000
commitb7889524bfe861e38aa7f384ed116f2b15068fe1 (patch)
tree02dd6e904a74daa135926fb397c1802376fc71f6 /actionpack
parent74d5f6ec0c7e1c91b3620d6785689a765f505069 (diff)
downloadrails-b7889524bfe861e38aa7f384ed116f2b15068fe1.tar.gz
rails-b7889524bfe861e38aa7f384ed116f2b15068fe1.tar.bz2
rails-b7889524bfe861e38aa7f384ed116f2b15068fe1.zip
Fix empty url_for with nested modules #707
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@782 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/routing.rb5
-rw-r--r--actionpack/test/controller/routing_tests.rb5
2 files changed, 8 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb
index a522b34f73..d270defa4d 100644
--- a/actionpack/lib/action_controller/routing.rb
+++ b/actionpack/lib/action_controller/routing.rb
@@ -215,8 +215,9 @@ module ActionController
options = options.symbolize_keys
defaults = request.path_parameters.symbolize_keys
- options = defaults if options.empty? # Get back the current url if no options was passed
- expand_controller_path!(options, defaults)
+ if options.empty? then options = defaults.clone # Get back the current url if no options was passed
+ else expand_controller_path!(options, defaults) # Expand the supplied controller path.
+ end
defaults.delete_if {|k, v| options.key?(k) && options[k].nil?} # Remove defaults that have been manually cleared using :name => nil
failures = []
diff --git a/actionpack/test/controller/routing_tests.rb b/actionpack/test/controller/routing_tests.rb
index 69fe6e2b2a..f1a3254a42 100644
--- a/actionpack/test/controller/routing_tests.rb
+++ b/actionpack/test/controller/routing_tests.rb
@@ -474,6 +474,11 @@ class RouteSetTests < Test::Unit::TestCase
@request.path_parameters = {:controller => 'content', :action => 'action', :id => '10'}
verify_generate 'content/action', {:id => nil}
end
+
+ def test_url_to_self
+ @request.path_parameters = {:controller => 'admin/users', :action => 'index'}
+ verify_generate 'admin/users', {}
+ end
end
#require '../assertions/action_pack_assertions.rb'