Skip to content

Instantly share code, notes, and snippets.

@arekt
Created Feb 7, 2014
Embed
What would you like to do?
Chaining ember promises in coffeescript
addProblem: (disease) ->
Ordering.MedicalRecord.store.find("medicalRecord",2)
.then (mr) =>
mr.get("problems")
.then (problems) =>
o = @store.createRecord("problem", {disease: disease, medicalRecord: mr})
.then (p) ->
p.save().then ->
console.log "Problem was saved correctly!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment