mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #29533 from jdelStrother/missing_url_formats
Fix missing formats in route-set URLs
This commit is contained in:
commit
d766b64b7e
2 changed files with 11 additions and 0 deletions
|
@ -279,6 +279,8 @@ module ActionDispatch
|
|||
if args.size < path_params_size
|
||||
path_params -= controller_options.keys
|
||||
path_params -= result.keys
|
||||
else
|
||||
path_params = path_params.dup
|
||||
end
|
||||
inner_options.each_key do |key|
|
||||
path_params.delete(key)
|
||||
|
|
|
@ -138,6 +138,15 @@ module ActionDispatch
|
|||
assert_equal "/a/users/1", url_helpers.user_path(1, foo: "a")
|
||||
end
|
||||
|
||||
test "implicit path components consistently return the same result" do
|
||||
draw do
|
||||
resources :users, to: SimpleApp.new("foo#index")
|
||||
end
|
||||
assert_equal "/users/1.json", url_helpers.user_path(1, :json)
|
||||
assert_equal "/users/1.json", url_helpers.user_path(1, format: :json)
|
||||
assert_equal "/users/1.json", url_helpers.user_path(1, :json)
|
||||
end
|
||||
|
||||
private
|
||||
def draw(&block)
|
||||
@set.draw(&block)
|
||||
|
|
Loading…
Reference in a new issue