# グループの所有者を取得する方法は？（Rails のコードに関する質問）

**URL:** <https://meta.discourse.org/t/how-to-retrieve-group-owners-rails-code-question/153610>\
**Category:** Development\
**Created:** [2020 年 6 月 2 日午後 7:17 UTC](https://meta.discourse.org/t/how-to-retrieve-group-owners-rails-code-question/153610 "2020-06-02T19:17:29Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![JQ331](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@JQ331](https://meta.discourse.org/u/JQ331)\
**Post date:** [2020 年 6 月 30 日午後 4:26 UTC](https://meta.discourse.org/t/how-to-retrieve-group-owners-rails-code-question/153610/11 "2020-06-30T16:26:34Z")

</div>

このケースにおいて、なぜそのシリアライザーが適切だと判断したのですか？

私が把握している限りでは、[groups controller](https://github.com/discourse/discourse/blob/master/app/controllers/groups_controller.rb) の `index` アクションには、`serialize_data` 呼び出しで `BasicGroupSerializer` を含む `render_json_dump` 関数（またはメソッド）があります。

グループデータを表示する関連ページは [groups index](https://github.com/discourse/discourse/blob/d3c972c30cafb8ca595a60233a30f75b2f95336c/app/assets/javascripts/discourse/app/templates/groups/index.hbs#L53-L53) なので、ここではコントローラーの `index` アクションが適切な対象となります。

つまり、`BasicGroupSerializer` がここで参照すべき正しいシリアライザーだと判断する根拠は、そのような仕組みに基づいているのでしょうか？

もし上記がすべて正しいなら、グループの詳細ページ（「groups.show」ビューは存在しないようですが）を表示する際には、コントローラーの `show` アクションで参照されている `GroupShowSerializer` が使用されるのでしょうか？

そして、コントローラーの `new` アクションのように、シリアライザーが参照されていない場合はどうなるのでしょうか？

---

_[View the full topic](https://meta.discourse.org/t/how-to-retrieve-group-owners-rails-code-question/153610)._
