Skip to content

Instantly share code, notes, and snippets.

@denstepa
Created September 14, 2015 11:49
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 denstepa/491c9991054e4be778f1 to your computer and use it in GitHub Desktop.
Save denstepa/491c9991054e4be778f1 to your computer and use it in GitHub Desktop.
rails - stop dots abuseing in emails
def no_dots_email_abuse
if User.where("(regexp_replace(users.email, '\\.', '', 'gi') LIKE ?)", email.gsub('.', '')).any?
errors.add(:email, 'is already taken. Please try another email.')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment