So let's say I have a model for a Game, and each Game has associated Game Cards. I would have a model like this:
Game.js
import DS from 'ember-data';
export default DS.Model.extend({
gamecards: DS.attr('string');
});
and in that gamecards attribute i would like to somehow convert an array of objects into string form in order to store it:
//for simplicity, assume each empty object has card attributes like 'suit', or 'value'
arrayOfGamecards = [//array of gamecard objects];
And then I could create an instance of Game which has:
gameCards: '[//array of gamecard objects]'
Ideally, I would also like to 'destringify' this array so I can do stuff with the objects inside of it. Is something like this possible with Ember?
Aucun commentaire:
Enregistrer un commentaire