@@ -11,28 +11,23 @@ export default Ember.Object.extend({
1111 'if' : get ( this , 'options.if' ) ,
1212 unless : get ( this , 'options.unless' )
1313 } ;
14- this . model . addObserver ( this . property , this , this . _validate ) ;
14+ this . dependentValidationKeys . pushObject ( this . property ) ;
15+ this . pushConditionalDependentValidationKeys ( ) ;
16+ this . addObserversForDependentValidationKeys ( ) ;
1517 } ,
16- addObserversForDependentValidationKeys : Ember . on ( 'init' , function ( ) {
18+ addObserversForDependentValidationKeys : function ( ) {
1719 this . dependentValidationKeys . forEach ( function ( key ) {
1820 this . model . addObserver ( key , this , this . _validate ) ;
1921 } , this ) ;
20- } ) ,
21- pushConditionalDependentValidationKeys : Ember . on ( 'init' , function ( ) {
22+ } ,
23+ pushConditionalDependentValidationKeys : function ( ) {
2224 Ember . A ( [ 'if' , 'unless' ] ) . forEach ( ( conditionalKind ) => {
2325 const conditional = this . conditionals [ conditionalKind ] ;
2426 if ( typeof ( conditional ) === 'string' && typeof ( this . model [ conditional ] ) !== 'function' ) {
2527 this . dependentValidationKeys . pushObject ( conditional ) ;
2628 }
2729 } ) ;
28- } ) ,
29- pushDependentValidationKeyToModel : Ember . on ( 'init' , function ( ) {
30- var model = get ( this , 'model' ) ;
31- if ( model . dependentValidationKeys [ this . property ] === undefined ) {
32- model . dependentValidationKeys [ this . property ] = Ember . A ( ) ;
33- }
34- model . dependentValidationKeys [ this . property ] . addObjects ( this . dependentValidationKeys ) ;
35- } ) ,
30+ } ,
3631 call : function ( ) {
3732 throw 'Not implemented!' ;
3833 } ,
0 commit comments