Skip to content

Instantly share code, notes, and snippets.

@sbauch
Created September 12, 2012 18:58
Show Gist options
  • Save sbauch/3709108 to your computer and use it in GitHub Desktop.
Save sbauch/3709108 to your computer and use it in GitHub Desktop.
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