Use defaultValue for making sure Name is at least ''
This commit is contained in:
parent
edea43e8a0
commit
26e69d2ad1
|
@ -7,7 +7,12 @@ export const SLUG_KEY = 'ID';
|
||||||
export default Model.extend({
|
export default Model.extend({
|
||||||
[PRIMARY_KEY]: attr('string'),
|
[PRIMARY_KEY]: attr('string'),
|
||||||
[SLUG_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'),
|
Type: attr('string'),
|
||||||
Rules: attr('string'),
|
Rules: attr('string'),
|
||||||
CreateIndex: attr('number'),
|
CreateIndex: attr('number'),
|
||||||
|
|
|
@ -13,8 +13,6 @@ export default Route.extend(WithAclActions, {
|
||||||
},
|
},
|
||||||
model: function(params) {
|
model: function(params) {
|
||||||
this.item = get(this, 'repo').create();
|
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);
|
set(this.item, 'Datacenter', this.modelFor('dc').dc.Name);
|
||||||
return hash({
|
return hash({
|
||||||
create: true,
|
create: true,
|
||||||
|
|
Loading…
Reference in New Issue