0
在Rails應用程序中,我有post
模型和相對post_locations
模型。我們使用searchkick來查找數據。當用戶輸入位置searchkick在location
表中查找到那個位置時,那我怎麼知道id
的位置。所以我需要的僅僅是在post_location
已知的ID中搜索帖子。Searchkick,僅在特定ID中搜索
實施例:
用戶搜索芝加哥,在位置表芝加哥有id = 1
。我需要在PostLocation.where(location_id: 1).posts.search 'other search params'
中搜索。任何想法我怎麼能做到這一點?
我能找到PostLocation只是這樣做'PostLocation.where(LOCATION_ID:1)',也沒有必要爲搜索踢,但我想在'POST'程序搜索特定'PostLocation '後ID號。這很難解釋。 –