diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-01-31 12:00:54 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-01-31 12:00:54 -0800 |
commit | e8fcd599ba6a301dbddb084f7369320ca3c49ff3 (patch) | |
tree | dcfe2c617e89cc9d9dbaf7ddc9029c5771e27d9e /actionpack/lib/action_dispatch/http | |
parent | 0b101804444e2cc57740b1c79cbd19f340f46cbf (diff) | |
download | rails-e8fcd599ba6a301dbddb084f7369320ca3c49ff3.tar.gz rails-e8fcd599ba6a301dbddb084f7369320ca3c49ff3.tar.bz2 rails-e8fcd599ba6a301dbddb084f7369320ca3c49ff3.zip |
only ask for the location filters once
Diffstat (limited to 'actionpack/lib/action_dispatch/http')
-rw-r--r-- | actionpack/lib/action_dispatch/http/filter_redirect.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/http/filter_redirect.rb b/actionpack/lib/action_dispatch/http/filter_redirect.rb index 900ce1c646..cd603649c3 100644 --- a/actionpack/lib/action_dispatch/http/filter_redirect.rb +++ b/actionpack/lib/action_dispatch/http/filter_redirect.rb @@ -5,7 +5,8 @@ module ActionDispatch FILTERED = '[FILTERED]'.freeze # :nodoc: def filtered_location - if !location_filter.empty? && location_filter_match? + filters = location_filter + if !filters.empty? && location_filter_match?(filters) FILTERED else location @@ -15,15 +16,15 @@ module ActionDispatch private def location_filter - if request.present? + if request request.env['action_dispatch.redirect_filter'] || [] else [] end end - def location_filter_match? - location_filter.any? do |filter| + def location_filter_match?(filters) + filters.any? do |filter| if String === filter location.include?(filter) elsif Regexp === filter |