# Userがそれぞれ Country, City typeを持っています。
Post-index にて......

**URL:** https://www.nocode-faq.com/t/topic/665
**Category:** bubble
**Created:** [2021 年 2 月 2 日午前 10:34 UTC](https://www.nocode-faq.com/t/topic/665 "2021-02-02T10:34:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Question\_user](https://avatars.discourse-cdn.com/v4/letter/q/53a042/32.png) [@Question\_user](https://www.nocode-faq.com/u/Question_user)
#### Post date: [2021 年 2 月 2 日午前 10:34 UTC](https://www.nocode-faq.com/t/topic/665/1 "2021-02-02T10:34:04Z")

</div>

Userがそれぞれ Country, City typeを持っています。  
Post-index にてCurrent User と同じCountryまたはCityを持つUserの投稿を表示する場合にはPostとUserでどういう関連づけをすれば良いでしょうか？  
例) User1 Country: Japan, City:Tokyo  
のときCounty:Japanをもつユーザーの投稿のみを表示したいです！  
【試したこと】  
Ruby on Rails のJoins的なものがbubbleにあるかと思いましたがよくわかりません。  
調べてもわからなかったので質問させていただきます！

---

<div class="post-metadata">

### Author: ![Answer\_user](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@Answer\_user](https://www.nocode-faq.com/u/Answer_user)
#### Post date: [2021 年 2 月 2 日午前 10:34 UTC](https://www.nocode-faq.com/t/topic/665/2 "2021-02-02T10:34:04Z")

</div>

回答者１  
repeating groupで、do search forを使っていると思いますが、その中に条件を絞り込む箇所があります。  
この写真はemail =になっていますが、カイトさんの場合は、 Country = current User’s countryとすれば、現在ログイン中のユーザーのcountryと一致する投稿が指定できます。

質問者  
返信ありがとうございます。  
その方法でUser-indexではCurrent UserののCountry, City typeに一致するUserをすべて表示することができたのですが。  
Post-indexでそれをやると以下のエラーが出てうまく表示されません。  
“RepeatingGroup Post:Data source should be list of Posts but right now it is a list of Users.  
回答者１さんの画像ではType of content が UserとなっていますがそれだとUserの投稿ではなくUserの一覧しか表示されなくないですか？  
僕は今 Type of content:Postでトライしてみてます。

回答者２  
今手元にパソコンがないので写真付きの説明ができず申し訳ございませんが、search for postとした上でその詳細をcreated by is in search for usersにすれば、対象ユーザーの投稿を表示できると思います！

質問者  
ありがとうございます！すごいです笑 is in search for users でなぜcurrent user の特定のfield をもつuserのpostを表示できるかわかりませんが二日間悩んでいた問題がおかげさまで解決いたしました！  
本当にありがとうございます

## 参考画像

 ![スクリーンショット 2020-09-07 14.50.31.png](https://us1.discourse-cdn.com/flex020/uploads/ncc_forum/original/1X/ed8fc84f6fb7b4c16ac693b9cbdbfde78ab21b19.png)
