Last active
August 29, 2015 14:16
-
-
Save EminenceHC/ed9e07e591554c60d411 to your computer and use it in GitHub Desktop.
add invalid date to errors
This file contains 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
def create | |
@referral = Referral.new(referral_params) | |
begin | |
params[:referral][:dob] = Date.strptime(params[:referral][:dob], '%m/%d/%Y') | |
rescue | |
@referral.errors.add(:dob, 'Invalid Date') | |
end | |
if @referral.save | |
redirect_to confirmation_page_referrals_path, notice: "Thank you for submitting this referral to Eminence Healthcare." | |
else | |
render :new | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment