Searching has_many association with Searchkick
问题 I'm attempting to build out a search feature for my app and am running into some issues with being able to search a has_many association. I want it set up so that a user only sees items that they have access to. In my user model, I have: class User < ApplicationRecord searchkick has_many :items, -> (user) { unscope(:where).where("(consumer_type = ? and consumer_id = ?))", 'User', user.id) }, fully_load: false, dependent: :destroy # not sure if this is helpful, was messing around with this def