Use defaultValue for making sure Name is at least ''

This commit is contained in:
John Cowen 2018-06-11 17:49:22 +01:00
parent e37136ecae
commit f87f410e3a
2 changed files with 6 additions and 3 deletions

View File

@ -7,7 +7,12 @@ export const SLUG_KEY = 'ID';
export default Model.extend({
[PRIMARY_KEY]: attr('string'),
[SLUG_KEY]: attr('string'),
Name: attr('string'),
Name: attr('string', {
// TODO: Why didn't I have to do this for KV's?
// this is to ensure that Name is '' and not null when creating
// maybe its due to the fact that `Key` is the primaryKey in Kv's
defaultValue: '',
}),
Type: attr('string'),
Rules: attr('string'),
CreateIndex: attr('number'),

View File

@ -13,8 +13,6 @@ export default Route.extend(WithAclActions, {
},
model: function(params) {
this.item = get(this, 'repo').create();
// TODO: Why didn't I have to do this for KV's?
set(this.item, 'Name', '');
set(this.item, 'Datacenter', this.modelFor('dc').dc.Name);
return hash({
create: true,