Exception: ActionController::UnpermittedParameters

Inherits:
IndexError
  • Object
show all
Defined in:
lib/action_controller/metal/strong_parameters.rb

Overview

Raised when a supplied parameter is not expected and ActionController::Parameters.action_on_unpermitted_parameters is set to :raise.

params = ActionController::Parameters.new(a: "123", b: "456")
params.permit(:c)
# => ActionController::UnpermittedParameters: found unpermitted parameters: :a, :b

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ UnpermittedParameters

:nodoc:



64
65
66
67
# File 'lib/action_controller/metal/strong_parameters.rb', line 64

def initialize(params) # :nodoc:
  @params = params
  super("found unpermitted parameter#{'s' if params.size > 1 }: #{params.map { |e| ":#{e}" }.join(", ")}")
end

Instance Attribute Details

#paramsObject (readonly)

:nodoc:



62
63
64
# File 'lib/action_controller/metal/strong_parameters.rb', line 62

def params
  @params
end