Skip to content

Instantly share code, notes, and snippets.

@bernharduw
Last active August 29, 2015 14:14
Show Gist options
  • Save bernharduw/cb935cce23b1ff333d03 to your computer and use it in GitHub Desktop.
Save bernharduw/cb935cce23b1ff333d03 to your computer and use it in GitHub Desktop.
Possible solution to create a nested Gallery model with Ampersand.js
var Collection = require('ampersand-rest-collection');
var AmpersandModel = require('ampersand-model');
var Gallery = Collection.extend({
model: function(attr) {
return new Gallery();
},
isModel: function(model) {
return model instanceof Gallery;
}
});
var GalleryItem = AmpersandModel.extend({
props: {
name: 'string',
picture: 'any'
},
collections: {
gallery: Gallery
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment