aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/mapper.rb
diff options
context:
space:
mode:
authorChris Arcand <chris@chrisarcand.com>2016-07-21 15:59:05 -0500
committerChris Arcand <chris@chrisarcand.com>2016-07-21 15:59:05 -0500
commit31fbbb7faccba25b2e3b5e10b8fca1468579d629 (patch)
treee04f75d020badc4ba2e210b1b54ef580b8af12a0 /actionpack/lib/action_dispatch/routing/mapper.rb
parentf88495d519f9bdacd542d61b4e8117eb4f79c173 (diff)
downloadrails-31fbbb7faccba25b2e3b5e10b8fca1468579d629.tar.gz
rails-31fbbb7faccba25b2e3b5e10b8fca1468579d629.tar.bz2
rails-31fbbb7faccba25b2e3b5e10b8fca1468579d629.zip
Fix 'defaults' option for root route
The merging of the 'defaults' option was moved up the stack in e852daa This allows us to see where these options originate from the standard HttpHelpers (get, post, patch, put, delete) Unfortunately this move didn't incorporate the 'root' method, which has always allowed the same 'defaults' option before.
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb9
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..fd68d4f185 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