instance method expect!

Ruby on Rails 8.1.2

Since v8.0.4

Available in: v8.0.4 v8.1.2

Signature

expect!(*filters)

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.

Parameters

filters rest
Source
# File actionpack/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

Defined in actionpack/lib/action_controller/metal/strong_parameters.rb line 786 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionController::Parameters

Type at least 2 characters to search.

↑↓ navigate · open · esc close