cayasso/oomvc — Issue #13: Do you always need a key for a collection setter?
Author: noctivityinc
Created: 2011-10-27 00:43:51+00:00
State: open

When creating a new setter for a collection:

space.lines(key, data);

what happens if I leave off the key:

space.lines(data);

For example, let's say I'm looping through records from a dB and want to populate the parent object. The database has no concept of a "key" for each record so its useless in this record. I would access each record by the index:

space.lines.index(2)

or through a loop. If I don't specify a key will it still add the record with some random key or will it fail? If it fails, can we support creating setters (this also includes using the create() and newRecord() methods) without specifying a key?