In a model I have a query like this to get active projects:
self.projects.where('start_date <= ?', Time.now).where('end_date >= ?', Time.now)
Now it can be possible to have an empty end_date. How can I make the second where optional so it only applies to filled in end_dates?
1 Answer