Use model.save() for saving records

Also, there is no need to use transactions anymore
This commit is contained in:
Piotr Sarnacki 2013-07-31 13:28:28 +02:00
parent 823c8441be
commit 670f38542a
2 changed files with 2 additions and 21 deletions

View File

@ -25,9 +25,5 @@ require 'travis/model'
toggle: ->
return if @get('isSaving')
transaction = @get('store').transaction()
transaction.add this
@set 'active', !@get('active')
transaction.commit()
@save()

View File

@ -27,10 +27,6 @@ require 'travis/model'
Ember.run.next this, ->
@poll() if @get('isSyncing')
Ember.run.next this, ->
transaction = @get('store').transaction()
transaction.add this
urlGithub: (->
"https://github.com/#{@get('login')}"
).property()
@ -43,18 +39,7 @@ require 'travis/model'
).property()
updateLocale: (locale) ->
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
@save()
Travis.setLocale(locale)
type: (->