Module: ParamProtected::ControllerModifications::InstanceMethods

Defined in:
lib/param_protected/controller_modifications.rb

Instance Method Summary collapse

Instance Method Details

#params_with_protectionObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/param_protected/controller_modifications.rb', line 37

def params_with_protection
  
  # #params is called internally by ActionController::Base a few times before an action is dispatched,
  # thus we can't filter and cache it right off the bat.  We have to wait for #action_name to be present
  # to know that we're really in an action and @_params actually contains something.  Then we can filter
  # and cache it.
  
  if action_name.blank?
    params_without_protection
  elsif @params_protected
    @params_protected
  else
    @params_protected = Protector.instance(self.class).protect(self, params_without_protection, action_name)
  end
  
end