Created
August 9, 2012 20:37
-
-
Save Breefield/3307850 to your computer and use it in GitHub Desktop.
Game Model in Spine.js
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
// 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