我试图获取大于另一个日期的空间列表日期。
到目前为止,我有......
Booking.where({ space_listing_id: 22, approved_status: true, ['move_out < ?', potential_move_in] })
我需要检查预订潜在日期是否大于每个space_listing with move_out date。
我的move_out和move_in是一个日期时间。
答案 0 :(得分:2)
为了在ActiveRecord查询中组合多个约束,您只需使用多个where
子句。
Booking.where(space_listing_id: 22, approved_status: true).where("move_out < ?", potential_move_in)