This is basically a redo of the #171 PR which is now a bit stale. I also included more tests for relation.coffee and another bug fix for when model instances are passed into .load().
The original bug:
Album.hasMany 'photos', Photo
Photo.belongsTo 'album', Album
album = new Album();
name: 'My Album',
name: 'Picture of a cat'
id: '456' # <= Triggers Bug!
Because id comes after photos, there's no parent record ID assigned yet to resolve the relation.
The other bug fix is exactly the same as #423
Assign record ID before other values to ensure that related models ar…
…e populated correctly.
Added more tests for relation.coffee
Bug fix for some failing tests in reation.coffee
I was holding off on #423 has own property thing because I was a little nervous how it might affect some of the relation stuff, but since you know that pretty well and are submitting this I am going to assume that should be okay, or that if it causes problems you won't blame me ;)
As always, thanks for the pull request!