Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

properly bind the ajax callback

  • Loading branch information...
commit a626c43481d7805f4e86943467f797f47e52f490 1 parent 84c7855
@collin authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/alpha_simprini/core/model/rest.coffee
View
6 lib/alpha_simprini/core/model/rest.coffee
@@ -34,18 +34,18 @@ AS.Model.REST = AS.Module.extend ({delegate, include, def, defs}) ->
unless model = AS.All.byId[id]
model = @new()
callback ?= model.didLoad
- @readOne id, callback
+ @readOne id, _.bind(callback, model)
return model
def didLoad: (data) ->
@loadData(data)
- defs readOne: (id, callback=@loadData) ->
+ defs readOne: (id, callback) ->
$.ajax
url: @resourceURL(id)
dataType: 'json'
- success: _.bind(callback, this)
+ success: callback
error: =>
console.error "readone error"
console.error(this, arguments)
Please sign in to comment.
Something went wrong with that request. Please try again.