Skip to content

Instantly share code, notes, and snippets.

@austinrfnd
Created June 24, 2013 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save austinrfnd/5847849 to your computer and use it in GitHub Desktop.
Save austinrfnd/5847849 to your computer and use it in GitHub Desktop.
I found this in an ActiveRecord Model.
def email_must_be_uniq
user = User.find_by_email(email)
if user.present? && user.id =! self.id
errors.add(:email, "is already taken")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment