Skip to content
New issue

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

fix: Gotcha with validation order #50

Merged
merged 1 commit into from
Oct 9, 2024
Merged

Conversation

jhurd2326
Copy link
Collaborator

@jhurd2326 jhurd2326 commented Oct 9, 2024

Description

Currently there is a gotcha where if you have validations that run before the has_state_machine call in a class definition, it will end up clearing out any existing errors on the object b/c we delegate the errors method to the object of the state instance and valid? clears any existing errors. This PR fixes this issue by removing the delegation and manually adding the errors to the object.

Checklist

  • I added the appropriate label to this PR.
  • I have made corresponding changes to the documentation if needed.
  • I have added tests that prove my change is effective.

Merging

Please choose the type of release that is required for this change.

  • 1. Major (breaking change)
  • 2. Minor (non-breaking, backwards compatible change)
  • 3. Patch (non-breaking, backwards compatible bug fix)
  • 4. No immediate release is required

@jhurd2326 jhurd2326 added bug Something isn't working Code Review labels Oct 9, 2024
@jhurd2326 jhurd2326 requested a review from bharget October 9, 2024 16:33
@jhurd2326 jhurd2326 self-assigned this Oct 9, 2024
Copy link
Member

@bharget bharget left a comment

Choose a reason for hiding this comment

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

🤘

@jhurd2326 jhurd2326 merged commit aaad007 into master Oct 9, 2024
1 check passed
@jhurd2326 jhurd2326 deleted the jhurd/fix-validation-gotcha branch October 9, 2024 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Code Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants