diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-07-27 20:27:17 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-07-27 20:28:54 -0300 |
commit | c1dc565f1e5da3d9a680cc25ae3a06c739d4d149 (patch) | |
tree | dd7535884fd6aaf5732b1bc1be1358c0f5f0fdbc /actionpack/lib/action_dispatch/routing | |
parent | 4f8a594f18004476c7851d8a59dae92fe001266e (diff) | |
parent | 2a946da9bbccfbd1e52b1164f4f4a77d5dbe3c10 (diff) | |
download | rails-c1dc565f1e5da3d9a680cc25ae3a06c739d4d149.tar.gz rails-c1dc565f1e5da3d9a680cc25ae3a06c739d4d149.tar.bz2 rails-c1dc565f1e5da3d9a680cc25ae3a06c739d4d149.zip |
Merge pull request #25913 from chrisarcand/fix-keyed-defaults-with-root
Fix keyed defaults with root
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 73b4864e45..12ddd0f148 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1923,7 +1923,14 @@ to this: def match_root_route(options) name = has_named_route?(:root) ? nil : :root - match '/', { :as => name, :via => :get }.merge!(options) + defaults_option = options.delete(:defaults) + args = ['/', { as: name, via: :get }.merge!(options)] + + if defaults_option + defaults(defaults_option) { match(*args) } + else + match(*args) + end end end |