Created
June 13, 2018 15:07
-
-
Save davelnewton/ea43be599dcd250272678bfb0d83125d to your computer and use it in GitHub Desktop.
Refactored start_date validation/modification
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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