diff --git a/app/adapters/ssh-key.coffee b/app/adapters/ssh-key.coffee index 1c052a97..f4bad312 100644 --- a/app/adapters/ssh-key.coffee +++ b/app/adapters/ssh-key.coffee @@ -19,7 +19,6 @@ Adapter = ApplicationAdapter.extend id = Ember.get(record, 'id') - this.ajax(this.urlPrefix() + '/ssh_key/' + id, "PATCH", { data: data }).then (data) -> - data.ssh_key + this.ajax(this.urlPrefix() + '/ssh_key/' + id, "PATCH", { data: data }) `export default Adapter` diff --git a/app/routes/settings.coffee b/app/routes/settings.coffee index 628b4443..92c6ed67 100644 --- a/app/routes/settings.coffee +++ b/app/routes/settings.coffee @@ -19,7 +19,9 @@ Route = TravisRoute.extend fetchCustomSshKey: () -> repo = @modelFor('repo') self = this - @store.find('ssh_key', repo.get('id')).then ( (result) -> result unless result.get('isNew') ), (xhr) -> + @store.find('ssh_key', repo.get('id')).then ( (result) -> + result unless result.get('isNew') + ), (xhr) -> if xhr.status == 404 # if there is no model, just return null. I'm not sure if this is the # best answer, maybe we should just redirect to different route, like diff --git a/app/serializers/ssh_key.js b/app/serializers/ssh_key.js index b6d77b1a..4d16c276 100644 --- a/app/serializers/ssh_key.js +++ b/app/serializers/ssh_key.js @@ -3,5 +3,10 @@ import ApplicationSerializer from 'travis/serializers/application'; export default ApplicationSerializer.extend({ serialize(snapshot, options) { return { ssh_key: this._super(...arguments) }; + }, + + normalizeSingleResponse(store, primaryModelClass, payload, id, requestType) { + payload = payload.ssh_key; + return this._super(store, primaryModelClass, payload, id, requestType); } });