Assign record ID before other values to ensure that related models are populated correctly.
Added more tests for relation.coffee
Bug fix for some failing tests in reation.coffee