This brings us to the last type of attribute we will use: the relationship attribute. Records are often related to each other as one-to-one, one-to-many, or many-to-many and we can encode this hierarchy in our SproutCore data model as well. To indicate a relationship, we use one of either
SC.SingleAttribute (that is, to one) or
SC.ManyAttribute (that is, to many), which is done just like we did with
SC.RecordAttribute by using
SC.Record helper methods. In this case, the helpers are
toMany to be exact.
For example, if you recall from our simple data model example of Calendar and Event records, we indicated a relationship between the two. This relationship will exist in the raw data on the server, such that ...