My notes are not flat. They have the following structure:
{ 'type' : 'node', 'properties' : { 'name' : 'sfddsadfsd', 'xxx' : 'sadfdsf', }, 'outputs' : { 'fghdf' : 'sadfdsf', 'xxxx' : 'sdfsd', } }
You get the idea. These fields ( properties and outputs ) do not apply to side entries; instead, they are part of my record (in my CouchDb database). I did this (before finding out that this is a sin by the standards of ember-data) because it is a convenient way to organize a large number of properties in a document - a term that CouchDb uses for recordings. This name also indicates why you want to have a structure in your record: because the document can become quite large, and therefore you need some kind of organizational structure to make your life easier (or, as I thought, before stumble upon ember-data).
I enjoyed modeling these records using the built-in properties with the previous version of ember data. Now, it seems that the ember-data data has given up support for inline records. There is a proposal to implement extractSingle and do some funky things with mapProperty('id');
Well: since they are part of my record, the built-in properties / outputs do not have a record identifier . There is simply no concept of property or output outside of node. They are not independent data with identifiers: they are only part of node.
I used to have the following model definition:
SettingsApp.NodeProperties = DS.Model.extend({ name : DS.attr('string'), }); DS.RESTAdapter.map('SettingsApp.NodeProperties', { name : {key: 'name'}, }); SettingsApp.Node = DS.Model.extend(SettingsApp.NodeMixin, { properties : DS.belongsTo('nodeProperties') }); DS.RESTAdapter.map('SettingsApp.Node', { nodeType: {key: 'type'}, outputs: {embedded: 'always'}, properties: {embedded: 'always'} });
( outputs is part of NodeMixin )
What are my options for modeling this with ember-data 1.0 beta? I have no idea what to do with these models, and I have about a dozen of them. It was quite difficult to put my record structure in ember-data, and now ... tighten, leave, it just doesn't work anymore.