jagi / meteor-astronomy

Model layer for Meteor
https://atmospherejs.com/jagi/astronomy
MIT License
604 stars 67 forks source link

Object with nested booleans #179

Closed ianmartorell closed 8 years ago

ianmartorell commented 8 years ago

I'm getting an error when defining an object with nested elements of type boolean. This used to work in version 1.1.5. Here's how I define the field:

'allergens': {
    type: 'object',
    default: function() { return {}; },
    nested: 'boolean'
}

Here's the error:

Error: The nested class for [fieldName] does not exist
W20151107-18:35:09.501(1)? (STDERR)     at new ObjectField (meteor://💻app/packages/jagi_astronomy/lib/modules/fields/types/object_field.js:11:1)
W20151107-18:35:09.501(1)? (STDERR)     at meteor://💻app/packages/jagi_astronomy/lib/modules/fields/init_definition.js:181:1
W20151107-18:35:09.501(1)? (STDERR)     at Function._.each._.forEach (meteor://💻app/packages/underscore/underscore.js:113:1)
W20151107-18:35:09.501(1)? (STDERR)     at Function.onInitDefinitionFields (meteor://💻app/packages/jagi_astronomy/lib/modules/fields/init_definition.js:177:1)
W20151107-18:35:09.501(1)? (STDERR)     at meteor://💻app/packages/jagi_astronomy/lib/modules/core/classes.js:27:1
W20151107-18:35:09.501(1)? (STDERR)     at meteor://💻app/packages/jagi_astronomy/lib/modules/core/events.js:68:1
W20151107-18:35:09.501(1)? (STDERR)     at Array.forEach (native)
W20151107-18:35:09.501(1)? (STDERR)     at Function._.each._.forEach (meteor://💻app/packages/underscore/underscore.js:105:1)
W20151107-18:35:09.501(1)? (STDERR)     at Object._.extend.each (meteor://💻app/packages/jagi_astronomy/lib/modules/core/events.js:64:1)
W20151107-18:35:09.501(1)? (STDERR)     at Function.methods.extend (meteor://💻app/packages/jagi_astronomy/lib/modules/core/classes.js:26:1)
W20151107-18:35:09.501(1)? (STDERR)     at Object.Astro.createClass.Astro.Class (meteor://💻app/packages/jagi_astronomy/lib/modules/core/classes.js:80:1)
...
lukejagodzinski commented 8 years ago

You can't do that. The nested property in the field the object type has to be a nested class. You can use boolean only in the field of the array type.

ianmartorell commented 8 years ago

I see, so I'll just not define the nested type, thanks