module ParamsParser::RailsIntegration

Public Instance Methods

parse(params) click to toggle source
Calls superclass method
# File lib/params_parser/rails_integration.rb, line 3
def parse(params)
  permit(super(params))
end

Private Instance Methods

permit(params) click to toggle source
# File lib/params_parser/rails_integration.rb, line 9
def permit(params)
  case params
  when ActionController::Parameters
    # The ParamsParser filters out parameters that are not explicitly
    # configured and #parse creates a new object so we are safe to call
    # #permit! here.
    #
    # 1. Any non configured parameters are already filtered out
    # 2. A new object is created by #parse so we are not mutating and
    #    implicitly permitting the parameters that were passed in.
    params.permit!
  else
    params
  end
end