-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add support for validations #29
Conversation
@@ -39,6 +40,10 @@ class Base | |||
# so it needs to be included last. | |||
include Dirty | |||
|
|||
# Overrides persistence methods, so it must included after | |||
include Validations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does including this after Dirty
cause any issues with the dirty tracking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After looking at the Validations
module, this shouldn't be an issue since it calls super
. However, if there are not specs around this already, it might a good idea to add some to verify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can go before or after Dirty, but it must be after Persistence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Looks good. |
Released in v2.2.0. |
This wires up ActiveModel::Validations to run when calling
save
andsave!
, in the same way that active record does it.This also includes ActiveModel::Validations::Callbacks which will add
before_validation
,after_validation
, etc.