Skip to content

Instantly share code, notes, and snippets.

@danielevans
Last active December 19, 2015 19:09
Show Gist options
  • Save danielevans/6004317 to your computer and use it in GitHub Desktop.
Save danielevans/6004317 to your computer and use it in GitHub Desktop.
Demonstrate CoffeeScript's super method in Backbone
class TestModel extends Backbone.Model
toJSON: ->
_.extend super,
success: true
json = (new TestModel(test: "success")).toJSON()
throw "no super data" unless json.test == "success"
throw "no child data" unless json.success == true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment