Skip to content

Instantly share code, notes, and snippets.

@martsie
Created January 25, 2017 08:36
Show Gist options
  • Save martsie/8b5e39890be4798538e2139f260f681d to your computer and use it in GitHub Desktop.
Save martsie/8b5e39890be4798538e2139f260f681d to your computer and use it in GitHub Desktop.
Backbone collection in CoffeeScript
# Define the collection.
class CommentCollection extends Backbone.Collection
model: Comment
# Create a new instance of the collection.
comments = new CommentCollection
# Add a few comments to the collection.
collection.add [
{name: 'Comment 1'},
{name: 'Comment 2'},
{name: 'Comment 3'}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment