Skip to content

Instantly share code, notes, and snippets.

@randallb
Created April 1, 2012 04:38
Show Gist options
  • Save randallb/2271437 to your computer and use it in GitHub Desktop.
Save randallb/2271437 to your computer and use it in GitHub Desktop.
exports.Collection = class Posts extends Backbone.Collection
initialize: (models, options) =>
@id = options.id
@activeDetails = false
@on "loadDetails", @loadDetails
@on "detailsLoaded", @logger
debug "initialized posts"
@fetch
beforeSend: () =>
console.log "about to fetch..."
@trigger "postsLoading"
success: (collection, response) =>
debug "successfully loaded ajax"
@trigger "postsLoaded"
error: (collection, response) => @trigger "postsLoadingError"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment