Instead of if end block consider:
array <<  user if (ab.date_from..ab.date_to).cover?(date)