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 isValid method #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sergejostir
Copy link

@sergejostir sergejostir commented Nov 23, 2020

isValid method in its current form doesn't work when the model exists. This is due to the model's validator always being set to create rules.

My PR makes a change, so when isValid is called, "exists" property of the model is checked and then the appropriate rule set is set to the validator. This way the isValid method will work properly in case the model exists in DB or if it does not.

I also applied this fix to the Observer and adjusted the tests as necessary.

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.

1 participant