diff options
author | Gannon McGibbon <gannon.mcgibbon@gmail.com> | 2018-11-20 13:16:39 -0500 |
---|---|---|
committer | Gannon McGibbon <gannon.mcgibbon@gmail.com> | 2018-11-20 14:55:47 -0500 |
commit | dde9c488398293fb1cbdc02595b8c4e9860b03cc (patch) | |
tree | 449385b6004d6c3d91f41b2e0eb8e990fc97ee0f /actionpack/lib/action_dispatch | |
parent | 023a840f5f10c5a611a0618ff8ea9e16cd771f93 (diff) | |
download | rails-dde9c488398293fb1cbdc02595b8c4e9860b03cc.tar.gz rails-dde9c488398293fb1cbdc02595b8c4e9860b03cc.tar.bz2 rails-dde9c488398293fb1cbdc02595b8c4e9860b03cc.zip |
Raise an error on root route naming conflicts.
Raises an ArgumentError when multiple root routes are defined in the
same context instead of assigning nil names to subsequent roots.
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 06ce165f76..421e2023c2 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -656,7 +656,7 @@ module ActionDispatch # Query if the following named route was already defined. def has_named_route?(name) - @set.named_routes.key? name + @set.named_routes.key?(name) end private @@ -1952,9 +1952,7 @@ module ActionDispatch end def match_root_route(options) - name = has_named_route?(name_for_action(:root, nil)) ? nil : :root - args = ["/", { as: name, via: :get }.merge!(options)] - + args = ["/", { as: :root, via: :get }.merge(options)] match(*args) end end |