[AC-2389] Alloy: Model Fetch by ID does not work on instances (singletons)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-06-24T13:16:39.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Alloy |
Labels | alloy, model, preferences |
Reporter | Sam Cleaver |
Assignee | Shak Hossain |
Created | 2013-06-22T01:50:08.000+0000 |
Updated | 2016-03-08T07:41:25.000+0000 |
Description
I have a preferences model which stores app preferences/settings; it uses the preferences sync adapter for this purpose. However when attempting to retrieve a result using the fetch({id:
var genretest = Alloy.createModel('preferences', {id: "genreversion"});
genretest.fetch();
Doesn't work (returns undefined):
var genretest2 = Alloy.Models.instance('preferences');
genretest2.fetch({id: "genreversion"});
Also doesn't work (something wrong with passing ID via fetch?)
var genretest = Alloy.createModel('preferences');
genretest.fetch({id: "genreversion"});
Obviously this is a performance issue as it means that singletons cannot be used throughout the app if a specific ID is desired (unless I've misinterpreted something).
I've attached my preferences.js model to assist in validation.
Attachments
File | Date | Size |
---|---|---|
preferences.js | 2013-06-22T01:50:08.000+0000 | 680 |