aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorRichard Schneeman <richard.schneeman+no-recruiters@gmail.com>2017-06-27 19:41:11 -0500
committerGitHub <noreply@github.com>2017-06-27 19:41:11 -0500
commitd766b64b7e137955b7c7dbab51d2b6e525de47c1 (patch)
tree40486920d4b81daab0b89a2bd16ec6384c5deba6 /actionpack
parent029c50735ba9a882ba67dd8219d61cf8698d6133 (diff)
parent2c0300389c3f6be00bf6c6b806332808a9400429 (diff)
downloadrails-d766b64b7e137955b7c7dbab51d2b6e525de47c1.tar.gz
rails-d766b64b7e137955b7c7dbab51d2b6e525de47c1.tar.bz2
rails-d766b64b7e137955b7c7dbab51d2b6e525de47c1.zip
Merge pull request #29533 from jdelStrother/missing_url_formats
Fix missing formats in route-set URLs
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb2
-rw-r--r--actionpack/test/dispatch/routing/route_set_test.rb9
2 files changed, 11 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index e1f9fc9ecc..68bd6d806b 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -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)
diff --git a/actionpack/test/dispatch/routing/route_set_test.rb b/actionpack/test/dispatch/routing/route_set_test.rb
index ace35dda53..d6ecbda092 100644
--- a/actionpack/test/dispatch/routing/route_set_test.rb
+++ b/actionpack/test/dispatch/routing/route_set_test.rb
@@ -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)