Skip to content

Instantly share code, notes, and snippets.

@davelnewton
Created June 13, 2018 15:07
Show Gist options
  • Save davelnewton/ea43be599dcd250272678bfb0d83125d to your computer and use it in GitHub Desktop.
Save davelnewton/ea43be599dcd250272678bfb0d83125d to your computer and use it in GitHub Desktop.
Refactored start_date validation/modification
class User
MIN_DATES = {
'student' => MINIMUM_STUDENT_START_DATE,
'professor' => MINIMUM_PROFESSOR_START_DATE
}
def handle_invalid_start_date
return unless valid_type?(type)
self.start_date = MIN_DATES[type] if start_date < MIN_DATES[type]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment