diff options
-rw-r--r-- | actionpack/lib/action_controller/metal/strong_parameters.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index ebbacfc455..91161aec4f 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -3,10 +3,17 @@ require 'active_support/core_ext/hash/indifferent_access' require 'active_support/rescuable' module ActionController + # Raised when a required parameter is missing. + # + # params = ActionController::Parameters.new(a: {}) + # params.fetch(:b) + # # => ActionController::ParameterMissing: key not found: b + # params.require(:a) + # # => ActionController::ParameterMissing: key not found: a class ParameterMissing < KeyError - attr_reader :param + attr_reader :param # :nodoc: - def initialize(param) + def initialize(param) # :nodoc: @param = param super("key not found: #{param}") end |