1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix generating params with optional defaults [#3404 state:resolved]

This commit is contained in:
Joshua Peek 2009-12-01 14:52:19 -06:00
parent 6ac32a8328
commit 61a31f3d3d
2 changed files with 2 additions and 4 deletions

View file

@ -175,7 +175,7 @@ module ActionDispatch
optional = false optional = false
elsif segment =~ /^:(\w+)$/ elsif segment =~ /^:(\w+)$/
if defaults.has_key?($1.to_sym) if defaults.has_key?($1.to_sym)
defaults.delete($1.to_sym) defaults.delete($1.to_sym) if defaults[$1.to_sym].nil?
else else
optional = false optional = false
end end

View file

@ -1639,9 +1639,7 @@ class RouteSetTest < ActiveSupport::TestCase
map.connect ':controller/:action/:id' map.connect ':controller/:action/:id'
end end
pending do assert_equal '/ibocorp', set.generate({:controller => 'ibocorp', :page => 1})
assert_equal '/ibocorp', set.generate({:controller => 'ibocorp', :page => 1})
end
end end
def test_generate_with_optional_params_recalls_last_request def test_generate_with_optional_params_recalls_last_request