Created
September 12, 2012 18:58
-
-
Save sbauch/3709108 to your computer and use it in GitHub Desktop.
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
validate :is_employee, :on => :create | |
def is_employee | |
if self.email.split("@")[1] == Settings.company_domain | |
#is employee, do nothing | |
else | |
# if i raise 'failed check'.inspect here I confirm that an @gmail.com does not satisfy the above conditional | |
errors.add(:email, "Not VM employee") #but then no matter what I put here the record still saves | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment