Skip to content

Commit

Permalink
Merge pull request #10654 from schneems/schneems/fix-route-regression
Browse files Browse the repository at this point in the history
Fix named routing regression from 3.2.13
  • Loading branch information
rafaelfranca committed May 16, 2013
2 parents 5dced4e + 2ee9a98 commit a63074d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions actionpack/lib/action_dispatch/routing/route_set.rb
Expand Up @@ -218,6 +218,7 @@ def handle_positional_args(t, args, options, keys)
keys -= t.url_options.keys if t.respond_to?(:url_options) keys -= t.url_options.keys if t.respond_to?(:url_options)
keys -= options.keys keys -= options.keys
end end
keys -= inner_options.keys
result.merge!(Hash[keys.zip(args)]) result.merge!(Hash[keys.zip(args)])
end end


Expand Down
11 changes: 11 additions & 0 deletions actionpack/test/dispatch/routing/route_set_test.rb
Expand Up @@ -69,6 +69,17 @@ def call(env)
end end
end end


test "explicit keys win over implicit keys" do
draw do
resources :foo do
resources :bar, to: SimpleApp.new('foo#show')
end
end

assert_equal '/foo/1/bar/2', url_helpers.foo_bar_path(1, 2)
assert_equal '/foo/1/bar/2', url_helpers.foo_bar_path(2, foo_id: 1)
end

private private
def clear! def clear!
@set.clear! @set.clear!
Expand Down

0 comments on commit a63074d

Please sign in to comment.