-
-
Save panupan/1023808 to your computer and use it in GitHub Desktop.
Bug is not present when using store.loadRecords instead of Fixtures
This file contains hidden or 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
// ========================================================================== | |
// Project: RecordBug | |
// Copyright: @2011 My Company, Inc. | |
// ========================================================================== | |
/*globals RecordBug */ | |
RecordBug = SC.Application.create({ | |
store: SC.Store.create().from(SC.Record.fixtures) | |
}); | |
RecordBug.Person = SC.Record.extend({ | |
name: SC.Record.attr(String) | |
}); | |
RecordBug.Friend = RecordBug.Person.extend({ | |
nickname: SC.Record.attr(String) | |
}); | |
RecordBug.Client = RecordBug.Person.extend({ | |
company: SC.Record.attr(String) | |
}); | |
SC.ready(function() { | |
RecordBug.mainPane = SC.TemplatePane.append({ | |
layerId: 'record_bug', | |
templateName: 'record_bug' | |
}); | |
var friends = [ | |
{ guid: 1, | |
name: "Lorem", | |
nickname: "this" | |
}, | |
{ guid: 2, | |
name: "Ipsum", | |
nickname: "is" | |
}, | |
{ guid: 3, | |
name: "Dolor", | |
nickname: "an example" | |
} | |
]; | |
var clients = [ | |
{ guid: 1, | |
name: "Lorem", | |
company: "this" | |
}, | |
{ guid: 2, | |
name: "Ipsum", | |
company: "is" | |
}, | |
{ guid: 3, | |
name: "Dolor", | |
company: "an example" | |
} | |
]; | |
RecordBug.store.loadRecords(RecordBug.Friend, friends); | |
RecordBug.store.loadRecords(RecordBug.Client, clients); | |
var before = RecordBug.store.find(RecordBug.Person); | |
SC.Logger.log('before: '+ before.length()); // Should be 6, prints 6 | |
var longQ = RecordBug.store.find([RecordBug.Friend, RecordBug.Client]); | |
SC.Logger.log('longQ: '+ longQ.length()); // Should be 6, prints 6 | |
var after = RecordBug.store.find(RecordBug.Person); | |
SC.Logger.log('after: '+ after.length()); // Should be 6, prints 6 | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment