I want to return an array with all rows in a table called bookings
where the column returned_date
is empty.
So far I've tried Booking.where("returned_date <> ''")
, which chose all the records where returned_date is present, but I want an inverse selection of this.
If you mean to get with
returned_date
column benull
:You could do with the below query
OR
You can add a scope in your
Booking
model asThen call it as
Booking.nil_returned_date