decide.nolog.cz/app/validators/model-alias.js
jelhan 5b8d59c00b rewrite create/options-datetime with ember-bootstrap
ToDo left:
refactor `datetimes` property of `create-options-datetime` component to
not cause whole list to be updated. This is not only a performance issue
but also UX: e.g. validation state is lost when another item is added.
2016-06-06 01:19:24 +02:00

16 lines
412 B
JavaScript

import Alias from 'ember-cp-validations/validators/alias';
import Ember from 'ember';
const { get } = Ember;
const ModelAlias = Alias.extend({
validate(value, options, model, attribute) {
const optionsModel = get(options, 'model');
if (optionsModel) {
model = get(model, optionsModel);
}
return this._super(value, options, model, attribute) || true;
}
});
export default ModelAlias;