Last active
December 15, 2015 20:49
-
-
Save iHiD/5321415 to your computer and use it in GitHub Desktop.
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
# Retrieve a belongsTo association | |
favourite = @get 'user_favourite' | |
# I'd like to do the following but it makes the | |
# record dirty, as user_favourite has changed. | |
# I really don't want user_favourite being tracked, | |
# But I want to get it with the initial JSON. | |
favourite.destroyRecord() | |
Meducation.store.commit() | |
# Instead - this works but feels v wrong :) | |
favourite = @get 'user_favourite' | |
transaction = Meducation.store.transaction() | |
transaction.add(fav) | |
favourite.deleteRecord() | |
favourite.one "didDelete", => | |
#... | |
transaction.commit() | |
transaction.remove(favourite) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment