Last active
January 2, 2016 04:29
-
-
Save consideRatio/8250757 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
SpeedMind.M = DS.Model.extend({ | |
mms : DS.hasMany('mm'), | |
name : DS.attr('string') | |
}); | |
SpeedMind.Mm = DS.Model.extend({ | |
m : DS.belongsTo('m'), | |
name : DS.attr('string'), | |
mmms : DS.hasMany('mmm') | |
}); | |
SpeedMind.Mmm = DS.Model.extend({ | |
mm : DS.belongsTo('mm'), | |
name : DS.attr('string') | |
}); |
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
{ | |
"m": { | |
"id": 1, | |
"name": "m1", | |
"mms": ["1", "2"] | |
}, | |
"mm": [{ | |
"id": "1", | |
"name": "mm1", | |
"mmms": ["1", "2"] | |
}, { | |
"id": "2", | |
"name": "mm2", | |
"mmms": ["3", "4"] | |
}], | |
"mmm": [{ | |
"id": "1", | |
"name": "mmm1" | |
}, { | |
"id": "2", | |
"name": "mmm2" | |
}, { | |
"id": "3", | |
"name": "mmm3" | |
}, { | |
"id": "4", | |
"name": "mmm4" | |
}] | |
} |
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
Background: | |
* i wanna use a local storage adapter | |
* i can reformat the JSON if i want | |
Question: How can I, using json above, add that data? What methods should i use? |
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.LSAdapter = DS.LSAdapter.extend({ | |
namespace: 'SpeedMindData' | |
}); | |
SpeedMind.ApplicationAdapter = DS.LSAdapter; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment