fix up collection view

This commit is contained in:
John Bintz 2011-05-13 10:04:42 -04:00
parent d7a77e672b
commit 755ffdb6c0
2 changed files with 3 additions and 6 deletions

View File

@ -4,8 +4,8 @@ Backbone.Collection.prototype.ensureFetched = (callback) ->
this.unbind('refresh', _refresher)
callback.apply(this)
@_alreadyEnsureFetched = true
@bind('refresh', _refresher)
@fetch()
this.bind('refresh', _refresher)
this.fetch()
else
callback.apply(this)

View File

@ -4,10 +4,7 @@ class window.<%= plural_object_name %>View extends Backbone.View
}
template: JST['<%= plural_underscore_name %>/list']
initialize: ->
@collection.bind('refresh', @addAll)
this.render()
@collection.fetch
@collection.bind('refresh', this.addAll)
render: =>
$(this.el).html(this.template())
this