conditional eager loading

Would merge work? Something like (off the top of my head):


where .occuring_on is

def self.occuring_on(day)
   where(:occurs_on => day)


Thank you for your suggestion, I tested it and it launches the same SQL request as

Shift.includes(:schedules).where("schedules.occurs_on = '#{}'")

which fails to return the shifts with no schedules or schedules not matching the condition. Because the where apply on the whole SQL instead of the JOIN condition.