I need support for collections in spine.js. I know that spine.js doesn't support this at the moment - not sure if it ever will.
Has anybody added this feature or know the best way to go about implementing it?
I need support for collections in spine.js. I know that spine.js doesn't support this at the moment - not sure if it ever will.
Has anybody added this feature or know the best way to go about implementing it?
This feature is built in.
Collections are just class methods on your model. The recommended way then is to simply add those few methods to your model.
If you need a different class for everything related to a collection (because you are used to ir ot something) you can simply create a new one that inherits from the original model and add the classmethods there.
sample: (check the console output) http://jsfiddle.net/SpoBo/vBtKC/
I could have just as easily moved the published class method to the Post model and all would have worked as well without the need of an extra PostCollection class. Your choice :)