Support setting the value of a has-one relationship to the last object in a collection

For more information see #1576.