require(key)
Instance Public methods
Ensures that a parameter is present. If it's present, returns the
parameter at the given key
, otherwise raises an
ActionController::ParameterMissing
error.
1 2 3 4 5 6 7 8 | ActionController::Parameters. new (person: { name: 'Francesco' }).require( :person ) # => {"name"=>"Francesco"} ActionController::Parameters. new (person: nil ).require( :person ) # => ActionController::ParameterMissing: param not found: person ActionController::Parameters. new (person: {}).require( :person ) # => ActionController::ParameterMissing: param not found: person |
Please login to continue.