I am using a squeel gem and I have a scenario that when user does not enter employee joining date then all the records should be returned else return record on the basis of employees joining date. my query is loke this :
date = Date.today Employee.joins { passports.visas }.where { (employees.joining_date.eq "%#{date}%")
so if date is not given by the user then what should I put the default value of date so that it retrieve all the record?
simply make call back
in Employee model before_create :joining_date
def joining_date self.joining_date = Date.today end