Are there alternative ways to set belongs-to relationships?
A belongs-to relationship can be set by associating the "parent" to the "child" object in two ways:
child_object.parent(parent_object);
or
child_object.parent_id = parent_object.id;
Note that the first case is a function, while the second is only using fields present on the objects which provides a slight performance benefit!
Hope this helps!
note: it’s also possible to set belongs-to relationships via CSV file import, as well as manually on the object direectly in the backend data browser