Skip to content
Advertisement

How do I write a Ruby where clause with dates and array lookup?

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.

Advertisement

Answer

You don’t need to use a SQL string to create that query. Just use a range:

If you want to use a SQL string you want to chain the calls:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement