Last active
January 2, 2016 01:09
-
-
Save consideRatio/8228702 to your computer and use it in GitHub Desktop.
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
## Example JSON Response | |
https://script.google.com/macros/s/AKfycbxoGOEaN-sxLty1zm0GEhsOZ3Ynd0FGpdH-2xfj5x9Q/dev?id=tp0nqCXf5y4x5XYLBjfPP2g&link=true | |
## JSON-View plugin for chrome: | |
https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc | |
## Goal | |
Have my JSON populate my store with loads of data | |
## Question #1 | |
Should i reformat my JSON somehow? I know for certain i want a lot of data coming in one bunch, and the natural format is for me the way it is, nested data, rather then writing list of ID's to indicate what belongs where... | |
## Question #2 | |
How do i populate the store? |
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
SpeedMind.Router.map(function () { | |
this.resource('source', { path: '/:source_id' }, function() { | |
this.resource('doc', { path: '/:doc_id' }, function() { | |
this.resource('collection', { path: '/:collection_id' }, function() { | |
this.resource('list', { path: '/:list_id' }); | |
}); | |
}); | |
}); | |
}); |
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
SpeedMind.Store = DS.Store.extend(); | |
SpeedMind.ApplicationAdapter = DS.LSAdapter.extend({ | |
namespace: 'SpeedMindData' | |
}); |
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
SpeedMind.Source = DS.Model.extend({ | |
docs : DS.hasMany('doc') | |
}); | |
SpeedMind.Collection = DS.Model.extend({ | |
doc : DS.belongsTo('doc'), | |
name : DS.attr('string'), | |
description : DS.attr('string'), | |
size : DS.attr('number'), | |
lists : DS.hasMany('list') | |
}); | |
SpeedMind.Doc = DS.Model.extend({ | |
source : DS.belongsTo('source'), | |
owner : DS.attr('string'), | |
description : DS.attr('string'), | |
collections : DS.hasMany('collection') | |
}); | |
SpeedMind.List = DS.Model.extend({ | |
collection : DS.belongsTo('collection'), | |
name : DS.attr('string'), | |
description : DS.attr('string'), | |
isCoupled : DS.attr('boolean'), | |
size : DS.attr('number'), | |
listEntries : DS.hasMany('listEntry') | |
}); | |
SpeedMind.ListEntry = DS.Model.extend({ | |
list : DS.belongsTo('list'), | |
obj1 : DS.attr('string'), | |
obj2 : DS.attr('string') | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment