Permalink
Browse files

keep a singleton filter around that we can use when no filter is set

  • Loading branch information...
1 parent 79e91cc commit 481f30ee657293ddc3460ba2a031c16c536887cd @tenderlove tenderlove committed Oct 19, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 actionpack/lib/action_dispatch/http/filter_parameters.rb
@@ -22,6 +22,8 @@ module Http
module FilterParameters
@@parameter_filter_for = {}
+ NULL_FILTER = ParameterFilter.new # :nodoc:
+
def initialize(env)
super
@filtered_parameters = nil
@@ -47,15 +49,17 @@ def filtered_path
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
parameter_filter_for(Array(@env["action_dispatch.parameter_filter"]) + [/RAW_POST_DATA/, "rack.request.form_vars"])
end
def parameter_filter_for(filters)
- @@parameter_filter_for[filters] ||= ParameterFilter.new(filters || [])
+ @@parameter_filter_for[filters] ||= ParameterFilter.new(filters)
end
KV_RE = '[^&;=]+'

0 comments on commit 481f30e

Please sign in to comment.