Check if key is defined in incomplete checks

This commit is contained in:
Piotr Sarnacki 2012-10-31 14:56:17 +01:00
parent baa95d590d
commit eef8e55cfe
2 changed files with 5 additions and 4 deletions

View File

@ -35,7 +35,8 @@
@get 'isLoaded'
).property('incomplete', 'isLoaded')
loadTheRest: ->
loadTheRest: (key) ->
console.log 'Load missing fields for', @constructor, "because of missing key '#{key}'"
return if @get('isCompleting')
@set 'isCompleting', true

View File

@ -3255,7 +3255,7 @@ DS.attr = function(type, options) {
return Ember.computed(function(key, value) {
var data;
if(arguments.length === 1 && this.constructor.isAttribute(key) && get(this, 'incomplete') && !this.isAttributeLoaded(key)) {
if(arguments.length === 1 && key && this.constructor.isAttribute(key) && get(this, 'incomplete') && !this.isAttributeLoaded(key)) {
if(this.loadTheRest) {
this.loadTheRest(key);
}
@ -3395,7 +3395,7 @@ var hasAssociation = function(type, options, one) {
var data = get(this, 'data'), ids, id, association,
store = get(this, 'store');
if(arguments.length === 1 && this.constructor.isAttribute(key) && get(this, 'incomplete') && !this.isAttributeLoaded(key)) {
if(arguments.length === 1 && key && this.constructor.isAttribute(key) && get(this, 'incomplete') && !this.isAttributeLoaded(key)) {
if(this.loadTheRest) {
this.loadTheRest(key);
}
@ -3463,7 +3463,7 @@ var hasAssociation = function(type, options) {
store = get(this, 'store'),
ids, id, association;
if(arguments.length === 1 && this.constructor.isAttribute(key) && get(this, 'incomplete') && !this.isAttributeLoaded(key)) {
if(arguments.length === 1 && key && this.constructor.isAttribute(key) && get(this, 'incomplete') && !this.isAttributeLoaded(key)) {
if(this.loadTheRest) {
this.loadTheRest(key);
}