From 4d3955aef459a5a303112e98f2f075753fc90e8c Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 30 May 2014 13:58:00 -0700 Subject: change defaults allocation to a one-liner --- actionpack/lib/action_dispatch/routing/mapper.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_dispatch/routing') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 4dda6d3101..afa90bda08 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -66,10 +66,9 @@ module ActionDispatch attr_reader :to, :default_controller, :default_action, :as, :anchor def initialize(scope, path, options) - @requirements, @conditions, @defaults = {}, {}, {} + @requirements, @conditions = {}, {} - @defaults.merge!(scope[:defaults]) if scope[:defaults] - @defaults.merge!(options.delete(:defaults)) if options[:defaults] + @defaults = (scope[:defaults] || {}).merge options.delete(:defaults) || {} options = scope[:options].merge(options) if scope[:options] @to = options.delete :to -- cgit v1.2.3