nicolasblanco/rails_param

InvalidParameterError does not contain "param" when coercion validation fails

Closed this issue ยท 3 comments

Basic Info

  • rails_param Version: 1.3.0
  • Ruby Version: 3.2.2
  • Rails Version: 7.0.6

Issue description

param! :foo, Float

With value aa, this raises InvalidParameterError with the message 'aa' is not a valid Float. However, InvalidParameterError#param returns nil. The parameter name is lost here.

Quick fix : in RailsParam::ParamEvaluator#param!, when calling #coerce, pass the parameter_name as argument so that it could be set when raising InvalidParameterError.

Thanks

Thanks @iMacTia ! Is it possible to cut a new release soon?

Awesome ๐Ÿ˜Ž