We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm using dry-validation for my models with ActiveRecord.
dry-validation
ActiveRecord
I'd like to know if there's a way to add a custom interpolation key to my validation.
For example:
schema = Dry::Validation.Schema do required(:time_table).value(type?: ModelClass) validate(previous_term_paid?: [:time_table]) do |time_table| if time_table.term > 1 && !time_table.previous.paid? false else true end end end schema.call(time_table: Model.find(...))
Is there a way to add time_table.previous.term to my error message ?
time_table.previous.term
The text was updated successfully, but these errors were encountered:
+1 simplest form:
validate(previous_term_paid?: [:time_table]) do |time_table, context| if time_table.term > 1 && !time_table.previous.paid? context.keys[:term] = time_table.previous.term false else true end end
Sorry, something went wrong.
This will be added during #440
No branches or pull requests
I'm using
dry-validation
for my models withActiveRecord
.I'd like to know if there's a way to add a custom interpolation key to my validation.
For example:
Is there a way to add
time_table.previous.term
to my error message ?The text was updated successfully, but these errors were encountered: