Exception: ActionController::ParameterMissing

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

Overview

Raised when a required parameter is missing.

params = ActionController::Parameters.new(a: {})
params.fetch(:b)
# => ActionController::ParameterMissing: param not found: b
params.require(:a)
# => ActionController::ParameterMissing: param not found: a

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(param) ⇒ ParameterMissing

:nodoc:



21
22
23
24
# File 'lib/action_controller/metal/strong_parameters.rb', line 21

def initialize(param) # :nodoc:
  @param = param
  super("param is missing or the value is empty: #{param}")
end

Instance Attribute Details

#paramObject (readonly)

:nodoc:



19
20
21
# File 'lib/action_controller/metal/strong_parameters.rb', line 19

def param
  @param
end