From 8aac1c062da7a188a9c3d6c3e5e5a84d6bfe64b2 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Wed, 2 Sep 2015 12:53:10 +0200 Subject: [PATCH] Rename sshKey to ssh_key for ember-data lookups --- app/components/add-ssh-key.coffee | 4 ++-- app/routes/settings.coffee | 2 +- app/routes/ssh-key.coffee | 2 +- tests/integration/components/add-ssh-key-test.js | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/components/add-ssh-key.coffee b/app/components/add-ssh-key.coffee index fc926589..0a77c7b7 100644 --- a/app/components/add-ssh-key.coffee +++ b/app/components/add-ssh-key.coffee @@ -10,7 +10,7 @@ AddSshKeyComponent = Ember.Component.extend didInsertElement: () -> id = @get('repo.id') - model = @get('store').recordForId('sshKey', id) + model = @get('store').recordForId('ssh_key', id) # TODO: this can be removed in favor of simply unloading record # once https://github.com/emberjs/data/pull/2867 # and https://github.com/emberjs/data/pull/2870 are merged @@ -20,7 +20,7 @@ AddSshKeyComponent = Ember.Component.extend idToRecord = typeMap.idToRecord delete idToRecord[id] - model = @get('store').createRecord('sshKey', id: id) + model = @get('store').createRecord('ssh_key', id: id) @set('model', model) isValid: () -> diff --git a/app/routes/settings.coffee b/app/routes/settings.coffee index 2c94c1da..226f4de8 100644 --- a/app/routes/settings.coffee +++ b/app/routes/settings.coffee @@ -18,7 +18,7 @@ Route = TravisRoute.extend fetchCustomSshKey: () -> repo = @modelFor('repo') self = this - @store.find('sshKey', 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/routes/ssh-key.coffee b/app/routes/ssh-key.coffee index b86db4d1..f97d323b 100644 --- a/app/routes/ssh-key.coffee +++ b/app/routes/ssh-key.coffee @@ -8,7 +8,7 @@ Route = TravisRoute.extend model: (params) -> repo = @modelFor('repo') self = this - @store.find('sshKey', 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/tests/integration/components/add-ssh-key-test.js b/tests/integration/components/add-ssh-key-test.js index 8e47afe3..f182ecf2 100644 --- a/tests/integration/components/add-ssh-key-test.js +++ b/tests/integration/components/add-ssh-key-test.js @@ -22,7 +22,7 @@ test('it adds an ssh key on submit', function(assert) { this.render(hbs`{{add-ssh-key repo=repo sshKeyAdded="sshKeyAdded"}}`); - var sshKey = store.all('sshKey').objectAt(0); + var sshKey = store.all('ssh_key').objectAt(0); assert.ok(! sshKey.get('description'), 'description should be blank'); assert.ok(! sshKey.get('value'), 'value should be blank'); @@ -54,7 +54,7 @@ test('it throws an error if value for ssh key is blank', function(assert) { this.render(hbs`{{add-ssh-key repo=repo sshKeyAdded="sshKeyAdded"}}`); - var sshKey = store.all('sshKey').objectAt(0); + var sshKey = store.all('ssh_key').objectAt(0); assert.ok(! sshKey.get('description'), 'description should be blank'); assert.ok(! sshKey.get('value'), 'value should be blank');