Fix assignment factory associations and ID

The short ID must be unique but the words generated by Faker is not.

The two associations should be lazily loaded, or else in some cases an
assignment might get created with null values for these associations.
Merge pull request #1603 from zhangsu/assignment_factory_fix

Fix assignment factory associations and ID