Hi --
We are using more or less the custom grape en.yml, which includes:
en:
grape:
errors:
format: ! '%{attributes} %{message}'
I'd like to keep this, but override it for one specific validator
module Internal
module Shared
module Validators
class MustAgree < Grape::Validations::Base
def validate_param!(attr_name, params)
unless @option && params[attr_name] == @option
raise Grape::Exceptions::Validation, params: @attrs, message: 'Please agree to continue'
end
end
end
end
end
end
The field is called "Agree" and we end up getting an error message on the frontend that says "Agree Please agree to continue"
I'd like to get rid of this leading Agree without changing the format for all error messages. Is this possible with custom validators?