Rename sshKey to ssh_key for ember-data lookups

This commit is contained in:
Piotr Sarnacki 2015-09-02 12:53:10 +02:00
parent 507dcc7376
commit 8aac1c062d
4 changed files with 6 additions and 6 deletions

View File

@ -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: () ->

View File

@ -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

View File

@ -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

View File

@ -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');