Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default values on nested inherited fields #54

Closed
atcwells opened this issue Jul 27, 2015 · 2 comments
Closed

Default values on nested inherited fields #54

atcwells opened this issue Jul 27, 2015 · 2 comments
Labels

Comments

@atcwells
Copy link

It doesn't appear that these work.. I realise it's an edge case!

Code something like this:

Parent = Astro.Class({
name: 'Parent',
fields: {
'system': {
type: 'object',
default: {}
},
'system.field2': {
type: 'string',
default: 'field2test'
},
});

Child = Base.extend({
name: 'Child',
collection: Childs,
fields: {
"field1": {
type: 'string',
default: 'field1test'
}
});

new Child().save();

The record created will have the values {} for system, and field1test for 'field1', but not the nested field. Moving the nested field up to the top level causes this default to be inserted properly.

Will see if I can dig in the code and suggest a fix.

@lukejagodzinski
Copy link
Member

Hi, thanks for letting know. I'm right now a little bit busy with private stuff and will have time to test it out after the weekend, so I would be glad if you could suggest a fix. However I will get back to it on Monday.

@lukejagodzinski
Copy link
Member

This bug was fixed, probably by accident :D in the next release. I won't publish it right now because it's bigger release. So, please wait for it. For now I'm closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants