sjdaws/vocal — pull request #10 by CWSpear (2014-12-08 06:16:59+00:00)
Title: [fix] belongsTo relationships don't work

I had this big long issue created explaining what I'd done to discover this issue, and then I'm all like, "Hey, I think I can fix this issue. I'll submit this and then create a PR," and then I hit **Fork** right there... which navigated away from the issue. Tried hitting back, but it was too late.

So I'm too tired to go into full detail, but the bottom line, it seems like `$this->$modelClass()->associate($record)->forceSave();` assumed that it saves the `$record` before associating it first, but it *does not*.

I added a test that if ran without my changes will fail (`parent` doesn't get created, and thus doesn't have an ID). If you run the tests again with my change (which saves the record before associating it), it works.