Exception: StrongParameters::Error::ParameterMissing

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

Overview

Raised when a required parameter is missing.

params = ActionController::Parameters.new(a: {})
params.fetch(:b)
# => ActionController::ParameterMissing: param is missing or the value is empty: b
params.require(:a)
# => ActionController::ParameterMissing: param is missing or the value is empty: a

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(param) ⇒ ParameterMissing

:nodoc:



13
14
15
16
# File 'lib/strong_parameters/error.rb', line 13

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

Instance Attribute Details

#paramObject (readonly)

:nodoc:



11
12
13
# File 'lib/strong_parameters/error.rb', line 11

def param
  @param
end