-
-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b3a64cc
commit 8c49695
Showing
10 changed files
with
765 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import Ember from 'ember'; | ||
|
||
let __EMBER_METAL__; | ||
if (Ember.__loader.registry['@ember/-internals/metal']) { | ||
__EMBER_METAL__ = Ember.__loader.require('@ember/-internals/metal'); | ||
} | ||
|
||
export function getDependentKeys(descriptorOrDecorator) { | ||
if (__EMBER_METAL__ && __EMBER_METAL__.descriptorForDecorator) { | ||
let descriptor = __EMBER_METAL__.descriptorForDecorator( | ||
descriptorOrDecorator | ||
); | ||
return descriptor._dependentKeys; | ||
} else { | ||
return descriptorOrDecorator._dependentKeys; | ||
} | ||
} | ||
|
||
export function isDescriptor(o) { | ||
if (__EMBER_METAL__ && __EMBER_METAL__.isClassicDecorator) { | ||
return __EMBER_METAL__.isClassicDecorator(o); | ||
} else { | ||
return ( | ||
o && (typeof o === 'object' || typeof o === 'function') && o.isDescriptor | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,29 @@ | ||
import Model from 'ember-data/model'; | ||
import { attr } from '@ember-decorators/data'; | ||
import { | ||
hasValidations, | ||
validator, | ||
buildValidations | ||
} from 'ember-cp-validations'; | ||
// TODO: make this pass | ||
|
||
// import Model from 'ember-data/model'; | ||
// import attr from 'ember-data/attr'; | ||
// import { | ||
// hasValidations, | ||
// validator, | ||
// buildValidations | ||
// } from 'ember-cp-validations'; | ||
|
||
// export const Validations = buildValidations({ | ||
// name: validator('presence', { presence: true, description: 'Name' }) | ||
// }); | ||
|
||
// @hasValidations(Validations) | ||
// export default class Company extends Model { | ||
// @attr('string') name; | ||
// } | ||
|
||
import DS from 'ember-data'; | ||
import { validator, buildValidations } from 'ember-cp-validations'; | ||
|
||
export const Validations = buildValidations({ | ||
name: validator('presence', { presence: true, description: 'Name' }) | ||
}); | ||
|
||
@hasValidations(Validations) | ||
export default class Company extends Model { | ||
@attr('string') name; | ||
} | ||
export default DS.Model.extend(Validations, { | ||
name: DS.attr('string') | ||
}); |
Oops, something went wrong.