diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-11-15 01:20:18 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-11-15 11:29:32 -0200 |
commit | 00adce4ff0b44865a7b3b7cec391220487e88565 (patch) | |
tree | d6203e43125264a6422986ddc9cefac49d636a13 /actionpack | |
parent | 3f2bf0dbe988db27843c87dd81b24500d8160372 (diff) | |
download | rails-00adce4ff0b44865a7b3b7cec391220487e88565.tar.gz rails-00adce4ff0b44865a7b3b7cec391220487e88565.tar.bz2 rails-00adce4ff0b44865a7b3b7cec391220487e88565.zip |
Avoid hash lookups for building an array of required defaults
Only set the value once after it's calculated.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index a537ed09b8..3d3299afb3 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -176,12 +176,13 @@ module ActionDispatch end end - @conditions[:required_defaults] = [] + required_defaults = [] options.each do |key, required_default| unless segment_keys.include?(key) || IGNORE_OPTIONS.include?(key) || Regexp === required_default - @conditions[:required_defaults] << key + required_defaults << key end end + @conditions[:required_defaults] = required_defaults via_all = options.delete(:via) if options[:via] == :all |