const Validations = buildValidations({
name: [
validator('presence', {
presence: true,
messageKey: 'errors.fieldRequired'
}),
validator('length', {
min: 2,
max: 50
})
],
password: [
validator('presence', {
presence: true,
messageKey: 'errors.fieldRequired'
}),
validator('length', {
min: 10,
max: 20
})
],
email: [
validator('presence', {
presence: true,
message: 'This field is required'
}),
validator('format', {
type: 'email',
message: 'Please enter a valid email address'
})
]
},{
description: 'This field',
dependentKeys: ['i18n.locale']
});
const Users = Model.extend(Validations, {
email: attr('string'),
password: attr('string'),
name: attr('string'),
created: attr('string'),
status: attr('string'),
isFormValid: Ember.computed.alias('validations.isValid')
});
|