# Eigentümer sind nicht zuweisbar, wenn die Gruppe über einen API-Aufruf erstellt wird

**URL:** <https://meta.discourse.org/t/owners-are-not-assignable-when-group-created-via-api-call/94913>\
**Category:** Development\
**Created:** [16. August 2018 um 19:58 UTC](https://meta.discourse.org/t/owners-are-not-assignable-when-group-created-via-api-call/94913 "2018-08-16T19:58:13Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![typeoneerror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/typeoneerror/32/80817_2.png) [@typeoneerror](https://meta.discourse.org/u/typeoneerror)\
**Post date:** [16. August 2018 um 20:02 UTC](https://meta.discourse.org/t/owners-are-not-assignable-when-group-created-via-api-call/94913/2 "2018-08-16T20:02:38Z")

</div>

Now that I’m looking at Discourse, I see where the `owner_ids` should be being assigned. Still looking at what `user_groups.build` does and where that relationship actually gets saved. I may be misunderstanding it, but it appears that those relationships are never saved, only the `group.save` is called whereas the group\_users are only built [`build`]. Does `group.save` actually call throught to `group.group_users` to persist the relationships?

> <https://github.com/discourse/discourse/blob/main/app/controllers/admin/groups_controller.rb#L45>

It may be that this use-case was missed because most folks create a group first and _then_ assign an owner to it. In this case the group is already persisted and you’re then using `add_owners`?

> <https://github.com/discourse/discourse/blob/main/app/controllers/admin/groups_controller.rb#L84>

If this is the bug I think it is, this would also apply to adding group users (not just owners) within the `#create` method.

---

_[View the full topic](https://meta.discourse.org/t/owners-are-not-assignable-when-group-created-via-api-call/94913)._
