check if model exists when cancelling ssh key

This commit is contained in:
Piotr Sarnacki 2015-02-10 11:56:33 +01:00
parent 81911777da
commit 15415999c2

View File

@ -53,8 +53,7 @@ Controller = Ember.ObjectController.extend Validations,
@set('model', null)
cancel: ->
model = @get('model')
console.log model.get('currentState.stateName')
if model = @get('model')
if model.get('currentState.stateName') == 'root.empty' ||
model.get('currentState.stateName').indexOf('root.loaded.created') != -1
@store.dematerializeRecord(model)