Need to add record to the new transaction after saving it

This commit is contained in:
Piotr Sarnacki 2012-09-28 19:09:05 +02:00
parent 82107bd1f3
commit b9179e3439
3 changed files with 15 additions and 5 deletions

View File

@ -57,10 +57,7 @@
localStorage?.setItem('travis.auto_signin', 'true')
sessionStorage?.setItem('travis.user', JSON.stringify(user))
@store.load(Travis.User, user)
user = @store.find(Travis.User, user.id)
transaction = @store.transaction()
transaction.add user
user
@store.find(Travis.User, user.id)
receiveMessage: (event) ->
if event.origin == @expectedOrigin()

View File

@ -16,6 +16,10 @@ require 'travis/model'
@poll() if @get('isSyncing')
@_super()
Ember.run.next this, ->
transaction = @get('store').transaction()
transaction.add this
urlGithub: (->
"https://github.com/#{@get('login')}"
).property()
@ -26,6 +30,15 @@ require 'travis/model'
transaction = @get('transaction')
transaction.commit()
self = this
observer = ->
unless self.get('isSaving')
self.removeObserver 'isSaving', observer
transaction = self.get('store').transaction()
transaction.add self
@addObserver 'isSaving', observer
type: (->
'user'
).property()

File diff suppressed because one or more lines are too long