Skip to content

feat: When an unrelated error is seen with negated allow_value, give a hint#1570

Merged
matsales28 merged 3 commits intothoughtbot:mainfrom
matsales28:other-attribute-failure-messaging
Dec 8, 2023
Merged

feat: When an unrelated error is seen with negated allow_value, give a hint#1570
matsales28 merged 3 commits intothoughtbot:mainfrom
matsales28:other-attribute-failure-messaging

Conversation

@matsales28
Copy link
Copy Markdown
Member

To clean out some old PRs, I'm trying to push and merge some changes so we can close them. This is basically a copy of #1238, making the adjustments suggested on the code view. All the credit from this PR goes to @antifun.

I am quoting the PR owner.

In cases when an unrelated error is seen that makes allow_value fail, the validation message was using the erroneous text "but it was valid instead". This changes the validation message to indicate which attribute(s) actually failed validation.

Fixes #919 (kinda sorta).

Closes: #919 and #1238

In cases when an unrelated error is seen that makes `allow_value` fail,
the validation message was using the erroneous text "but it was valid
instead". This changes the validation message to indicate which
attribute(s) actually failed validation.
@matsales28 matsales28 self-assigned this Aug 18, 2023
@matsales28 matsales28 force-pushed the other-attribute-failure-messaging branch from 9e58506 to 6b6b227 Compare August 18, 2023 14:52
@matsales28 matsales28 force-pushed the other-attribute-failure-messaging branch from 6b6b227 to 7304b8f Compare August 18, 2023 14:54
This spec was failing because the polymorphic association was not optional,
that was causing it to have an error on the association and not in the attribute
`severity_type` that was being validated the inclusion.

Setting the association as optional fixed the issue.
Copy link
Copy Markdown
Collaborator

@vsppedro vsppedro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@matsales28 matsales28 merged commit f2db1f2 into thoughtbot:main Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

negative allow_value matcher incorrectly fails when validation message is custom but not passed to matcher

3 participants