1
我對軌道仍然很陌生,試圖弄清楚這一點。在另一個活動記錄上過濾活動記錄
我有幾個型號:
約會= belongs_to的廠商 廠商HAS_MANY通過vendor_locations
我基於區域位置過濾一些地圖標記位置:
if params[:search].present?
location_ids = Location.near(params[:search], 50, order: '').pluck(:id)
@vendor_locations = VendorLocation.includes(:location).where(location_id: location_ids)
else
location_ids = Location.near([session[:latitude], session[:longitude]], 50, order: '').pluck(:id)
@vendor_locations = VendorLocation.includes(:location).where(location_id: location_ids)
end
我我試圖過濾那些與搜索區域中的供應商相關聯的活動APPOINTMENTS。
我試圖設置活動記錄與包括:
def index
if params[:service].blank?
@appointments = Appointment.includes(:vendor).where(vendors: {id: @vendor_locations.vendor_id})
但那顯然不工作。有關如何基於@vendor_locations過濾的任何建議?
現在定義工作。你有什麼錯誤嗎? – Pavan