123456789_123456789_123456789_123456789_123456789_

Exception: ActionController::ParameterMissing

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, KeyError
Instance Chain:
self, DidYouMean::Correctable, KeyError
Inherits: KeyError
  • ::Object
Defined in: actionpack/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 is missing or the value is empty or invalid: b
params.require(:a)
# => ActionController::ParameterMissing: param is missing or the value is empty or invalid: a
params.expect(a: [])
# => ActionController::ParameterMissing: param is missing or the value is empty or invalid: a

Class Method Summary

Instance Attribute Summary

  • #keys readonly Internal use only
  • #param readonly Internal use only

Instance Method Summary

Constructor Details

.new(param, keys = nil) ⇒ ParameterMissing

This method is for internal use only.
[ GitHub ]

  
# File 'actionpack/lib/action_controller/metal/strong_parameters.rb', line 28

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

Instance Attribute Details

#keys (readonly)

This method is for internal use only.
[ GitHub ]

  
# File 'actionpack/lib/action_controller/metal/strong_parameters.rb', line 26

attr_reader :param, :keys # :nodoc:

#param (readonly)

This method is for internal use only.
[ GitHub ]

  
# File 'actionpack/lib/action_controller/metal/strong_parameters.rb', line 26

attr_reader :param, :keys # :nodoc:

Instance Method Details

#corrections

This method is for internal use only.
[ GitHub ]

  
# File 'actionpack/lib/action_controller/metal/strong_parameters.rb', line 37

def corrections # :nodoc:
  @corrections ||= DidYouMean::SpellChecker.new(dictionary: keys).correct(param.to_s)
end