1

I'm trying to grab space listing date which is greater than another date.

So far, I have...

    Booking.where({ space_listing_id: 22, approved_status: true, ['move_out < ?', potential_move_in] })

I need to check if the Booking potential date is greater than each space_listing with move_out date.

My move_out and move_in is a datetime.

CinCout
  • 9,486
  • 12
  • 49
  • 67
Anna_Natorilla
  • 157
  • 2
  • 13

1 Answers1

2

In order to combine multiple constraints in an ActiveRecord query, you can simply use multiple where clause.

Booking.where(space_listing_id: 22, approved_status: true).where("move_out < ?", potential_move_in)
Abhinay
  • 1,796
  • 4
  • 28
  • 52