Method: ActionController::Parameters#expect!

Defined in:
lib/action_controller/metal/strong_parameters.rb

#expect!(*filters) ⇒ Object

Same as expect, but raises an ActionController::ExpectedParameterMissing instead of ActionController::ParameterMissing. Unlike expect which will render a 400 response, expect! will raise an exception that is not handled. This is intended for debugging invalid params for an internal API where incorrectly formatted params would indicate a bug in a client library that should be fixed.



786
787
788
789
790
# File 'lib/action_controller/metal/strong_parameters.rb', line 786

def expect!(*filters)
  expect(*filters)
rescue ParameterMissing => e
  raise ExpectedParameterMissing.new(e.param, e.keys)
end