Only coerce belongsTo ids to string if id is defined