diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-23 20:40:21 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-24 09:19:21 -0200 |
commit | d98014cbcb0bf38f4ecd433d945047fc67fccc36 (patch) | |
tree | d052b27a045e0d8ce2c9d2b6539f4993c593bf26 /actionpack | |
parent | 2b64e9b1bde13783ddca55dbf27e36c9c35364b2 (diff) | |
download | rails-d98014cbcb0bf38f4ecd433d945047fc67fccc36.tar.gz rails-d98014cbcb0bf38f4ecd433d945047fc67fccc36.tar.bz2 rails-d98014cbcb0bf38f4ecd433d945047fc67fccc36.zip |
Use merge! in some places to avoid creating extra hashes
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/routing/redirection.rb | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 66b7963eaf..ac078174ed 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -152,7 +152,7 @@ module ActionDispatch end def conditions - { :path_info => @path }.merge(constraints).merge(request_method_condition) + { :path_info => @path }.merge!(constraints).merge!(request_method_condition) end def requirements @@ -285,7 +285,7 @@ module ActionDispatch # of most Rails applications, this is beneficial. def root(options = {}) options = { :to => options } if options.is_a?(String) - match '/', { :as => :root, :via => :get }.merge(options) + match '/', { :as => :root, :via => :get }.merge!(options) end # Matches a url pattern to one or more routes. Any symbols in a pattern @@ -845,7 +845,7 @@ module ActionDispatch end def merge_options_scope(parent, child) #:nodoc: - (parent || {}).except(*override_keys(child)).merge(child) + (parent || {}).except(*override_keys(child)).merge!(child) end def merge_shallow_scope(parent, child) #:nodoc: diff --git a/actionpack/lib/action_dispatch/routing/redirection.rb b/actionpack/lib/action_dispatch/routing/redirection.rb index d70063d0e9..d751e04e6a 100644 --- a/actionpack/lib/action_dispatch/routing/redirection.rb +++ b/actionpack/lib/action_dispatch/routing/redirection.rb @@ -75,7 +75,7 @@ module ActionDispatch :port => request.optional_port, :path => request.path, :params => request.query_parameters - }.merge options + }.merge! options if !params.empty? && url_options[:path].match(/%\{\w*\}/) url_options[:path] = (url_options[:path] % escape_path(params)) |