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

Add support for validations #29

Merged
merged 3 commits into from
May 14, 2015
Merged

Conversation

brianstien
Copy link
Collaborator

This wires up ActiveModel::Validations to run when calling save and save!, in the same way that active record does it.

This also includes ActiveModel::Validations::Callbacks which will add before_validation, after_validation, etc.

@@ -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
Copy link
Owner

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?

Copy link
Owner

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.

Copy link
Collaborator Author

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

Copy link
Owner

Choose a reason for hiding this comment

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

👍

@liveh2o
Copy link
Owner

liveh2o commented May 14, 2015

Looks good.

liveh2o added a commit that referenced this pull request May 14, 2015
@liveh2o liveh2o merged commit 27c9c24 into liveh2o:master May 14, 2015
@liveh2o
Copy link
Owner

liveh2o commented May 14, 2015

Released in v2.2.0.

@liveh2o liveh2o mentioned this pull request May 14, 2015
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.

2 participants