diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-10-18 17:50:02 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-10-18 17:50:02 -0700 |
commit | 481f30ee657293ddc3460ba2a031c16c536887cd (patch) | |
tree | b0a0927ad8225d0cccd3f6999c07eb4c897d15ee /actionpack/lib | |
parent | 79e91cc0ec2312bd3257ce0ef3323e1add65a36f (diff) | |
download | rails-481f30ee657293ddc3460ba2a031c16c536887cd.tar.gz rails-481f30ee657293ddc3460ba2a031c16c536887cd.tar.bz2 rails-481f30ee657293ddc3460ba2a031c16c536887cd.zip |
keep a singleton filter around that we can use when no filter is set
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/http/filter_parameters.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/http/filter_parameters.rb b/actionpack/lib/action_dispatch/http/filter_parameters.rb index 91dfec5c35..8e3443f349 100644 --- a/actionpack/lib/action_dispatch/http/filter_parameters.rb +++ b/actionpack/lib/action_dispatch/http/filter_parameters.rb @@ -22,6 +22,8 @@ module ActionDispatch module FilterParameters @@parameter_filter_for = {} + NULL_FILTER = ParameterFilter.new # :nodoc: + def initialize(env) super @filtered_parameters = nil @@ -47,7 +49,9 @@ module ActionDispatch protected def parameter_filter - parameter_filter_for(@env["action_dispatch.parameter_filter"]) + parameter_filter_for @env.fetch("action_dispatch.parameter_filter") { + return NULL_FILTER + } end def env_filter @@ -55,7 +59,7 @@ module ActionDispatch end def parameter_filter_for(filters) - @@parameter_filter_for[filters] ||= ParameterFilter.new(filters || []) + @@parameter_filter_for[filters] ||= ParameterFilter.new(filters) end KV_RE = '[^&;=]+' |