aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-12-01 14:52:19 -0600
committerJoshua Peek <josh@joshpeek.com>2009-12-01 14:52:19 -0600
commit61a31f3d3dae55b3ed2a49fafcbfe45b77ea3be2 (patch)
tree1b361263eb8dcdeb9cb76740d4e63fadc88fcd1e /actionpack
parent6ac32a83283f46b55675ddf4ecab6c91f6f8abde (diff)
downloadrails-61a31f3d3dae55b3ed2a49fafcbfe45b77ea3be2.tar.gz
rails-61a31f3d3dae55b3ed2a49fafcbfe45b77ea3be2.tar.bz2
rails-61a31f3d3dae55b3ed2a49fafcbfe45b77ea3be2.zip
Fix generating params with optional defaults [#3404 state:resolved]
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/routing/deprecated_mapper.rb2
-rw-r--r--actionpack/test/controller/routing_test.rb4
2 files changed, 2 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb b/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb
index dd76391870..87dfaba6c7 100644
--- a/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb
@@ -175,7 +175,7 @@ module ActionDispatch
optional = false
elsif segment =~ /^:(\w+)$/
if defaults.has_key?($1.to_sym)
- defaults.delete($1.to_sym)
+ defaults.delete($1.to_sym) if defaults[$1.to_sym].nil?
else
optional = false
end
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index b5effeda40..97fbd95e73 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -1639,9 +1639,7 @@ class RouteSetTest < ActiveSupport::TestCase
map.connect ':controller/:action/:id'
end
- pending do
- assert_equal '/ibocorp', set.generate({:controller => 'ibocorp', :page => 1})
- end
+ assert_equal '/ibocorp', set.generate({:controller => 'ibocorp', :page => 1})
end
def test_generate_with_optional_params_recalls_last_request