rails sunspot date range in association table

55 Views Asked by At
class Event
    belongs_to :resource, polymorphic: true, optional: true
end

class Planner
  has_many events

  searchable do 
  
    date :filed_at, multiple: true do
      events.map {|event| event.filed_at}.uniq
    end
 
  end

end

have these two models and I'm trying to get the planner date range in associated fields in events.

this is my controller for my search sunspot

  if params[:starts_on_from].present? && params[:starts_on_to].present?
      with(:filed_at, params[:starts_on_from].to_date..params[:starts_on_to].to_date)
  end

but I can't get the record. how can I achieve this

0

There are 0 best solutions below