I'm trying to integrate ember-cp-validations to my project, so far now the code runs k but when i try to run "validate" methods i receive this error
Uncaught TypeError: Validator.getDependentsFor is not a function
I tracked down the error to this line
https://github.com/offirgolan/ember-cp-validations/blob/v2.9.3/addon/validations/factory.js#L436
const dependents = Validator.getDependentsFor(attribute, options) || [];
which tries to call a function getDependentsFor
on a Validator object returned here
https://github.com/offirgolan/ember-cp-validations/blob/v2.9.3/addon/validations/factory.js#L434
const Validator = type === 'function' ? BaseValidator : lookupValidator(owner, type);
as type equals to "presence" it looks for the validator using lookupValidator
and it's found but the class returned does not have the function getDependentsFor
, i'm not sure if this is a bug or i'm missing something :/
Versions Ember : 2.5.1 Ember Data : 2.6.1 ember-cp-validations : 2.9.3
import { validator, buildValidations } from 'ember-cp-validations';
const Validations = buildValidations({
email: [
validator('presence', true),
validator('format', { type: 'email', allowBlank: true })
]
});
var User;
User = DS.Model.extend(Validations, {
...
})
Any help will be appreciated!
Thanks in advance!!!