Skip to content

Instantly share code, notes, and snippets.

@Breefield
Created August 9, 2012 20:37
Show Gist options
  • Save Breefield/3307850 to your computer and use it in GitHub Desktop.
Save Breefield/3307850 to your computer and use it in GitHub Desktop.
Game Model in Spine.js
// Create model extending from Spine Model
window.Game = Spine.Model.sub({
// No documentation about this, refered to in controller documenation
init: function() {
this.players = 2;
}
});
// What accessors does it have?
Game.configure('Game', 'players');
// Create our association
Game.hasOne('board', 'Board');
Game.extend(Spine.Model.Ajax);
/* Sine automatically hooks the model up to "/boards"
* However we could choose a manual API enpoint with the following:
Contact.extend({url: "/boards"});
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment