-
-
Notifications
You must be signed in to change notification settings - Fork 173
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
Support validations via inheritance #112
Conversation
ping @rwjblue 😸 |
return createMixin(GlobalValidations, AttrValidations); | ||
init() { | ||
this._super(...arguments); | ||
this.set('validations', Validations.create({ |
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.
don't we usually want to do this on-demand via CP getter?
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.
That's what it was before, but because of this line, it goes into an infinite loop.
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.
that is an empty line
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.
LOL it changed after I made a commit. See here
For some reason, the getter keeps recomputing and doesnt cache the object, so it keeps calling itself when checking for an inherited validations object.
c23017e
to
3078eee
Compare
@stefanpenner ready for final review |
} | ||
}); | ||
// Caches | ||
_validators: {}, |
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.
i think the caches want to be on the instance, not the prototype.
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.
Caches were always on the proto. That's how we decided to write them. They are cached by model guid. See test here
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.
You can see the code for the cache. If we remove it from the proto, there isnt really a need for this...
Support validations via inheritance
Resolves #111
Allows validations to persist through inheritance