Created
May 20, 2013 18:09
-
-
Save emirotin/5614067 to your computer and use it in GitHub Desktop.
save Ember model (ember-restless) and redirect to its route
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
saveAndRedirect = (redirectTo) -> | |
-> | |
model = @get('model') | |
model.saveRecord() | |
done = => | |
model = model.constructor.find model.id | |
model.on 'didLoad', => | |
@transitionToRoute redirectTo, model | |
model.on 'didCreate', done | |
model.on 'didUpdate', done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment