跳至内容 跳至搜索

当缺少必需参数时引发。

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