Skip to content

Instantly share code, notes, and snippets.

@daGrevis
Created March 25, 2013 20:21
Show Gist options
  • Select an option

  • Save daGrevis/5240358 to your computer and use it in GitHub Desktop.

Select an option

Save daGrevis/5240358 to your computer and use it in GitHub Desktop.
jQuery ->
class MyModel extends Backbone.Model
parse: (response) ->
x = response.objects
console.log x
x
class ItemModel extends MyModel
class ItemsCollection extends Backbone.Collection
url: "/api/v1/item/"
model: ItemModel
class CategoryModel extends Backbone.Model
class CategoriesCollection extends Backbone.Collection
model: ItemModel
class ItemsView extends Backbone.View
el: $ "#items"
initialize: ->
_.bindAll @
@items_collection = new ItemsCollection
@items_collection.on "sync", @render
@items_collection.fetch()
render: ->
console.log @items_collection
@items_collection.each (item, i) ->
console.log i
console.log item
items_view = new ItemsView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment