def age_for_dob(dob)
      today = Time.now.utc.to_date
      return nil unless dob && today >= dob
      today.year - dob.year - ((today.month > dob.month || (today.month == dob.month && today.day >= dob.day)) ? 0 : 1)
    end
def age_for_dob(dob)
      today = Time.now.utc.to_date
      return nil unless dob && today >= dob
      today.year - dob.year - ((today.month > dob.month || (today.month == dob.month && today.day >= dob.day)) ? 0 : 1)
    end
stackoverflow.com/questions/819263