Skip to content

Records guide is unclear on how to use the toMany relation properly #102

@SpacyRicochet

Description

@SpacyRicochet

The Records guide (http://guides.sproutcore.com/records.html) is very clear on how to create the different types of relations, such as one-to-many. However, while trying to unit test such a relation by creating and pushing an object, I found out that the guide is wholly inadequate in explaining how you would use objects stored a toMany relation.

The following gist (https://gist.github.com/1276759) shows the frustration I had. The guide doesn't clearly mention that you have to set an ID first, before any relation with an object can make sense and the object is able to be used again through that relation. Also, a little note that ManyArrays won't work with the bracketed index (ie. testObject.get('toManyObjects')[0]), but only with objectAt() is worth mentioning.

This is something that might be obvious to those more used to databases, but not to those that are new to the concept.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions