local_appointment_records = ExternalAppointment.where(external_id: appointment_ids, deleted_by: nil, ('start_time BETWEEN ? AND ?',@date_from, @date_to) )
I want to do something like the above. I first want to check if the model external id is in the array of appointment_ids, then make sure it is not soft deleted and then check if the record start time is between dates.. Any help much appreciated.