Skip to content

Instantly share code, notes, and snippets.

@iqbalhasnan
Created January 18, 2015 23:37
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 iqbalhasnan/d6ec37248e546d1f99d4 to your computer and use it in GitHub Desktop.
Save iqbalhasnan/d6ec37248e546d1f99d4 to your computer and use it in GitHub Desktop.
reserved username
RESERVED_WORDS = ["admin", "users","help", "about", "account", "login", "signup", "logout", "edit", "index",
"stylesheets","account","reset", "assets", "javascripts", "images", "privacy",
"a", "about", "tos","contact","comments","likes","photos","albums","popular", "tour", "activity", "discover", "annotations", "activities", "notifications", "follower_requests"]
validates :username, presence: true, format: { with: USERNAME_REGEX, message: "Your username can only contain letters A-Z, numbers 0-9, and underscores."}, length: { maximum: 15 }, uniqueness: { case_sensitive: false, message: "That username is not available"}, exclusion: { in: RESERVED_WORDS, message: "\"%{value}\" is reserved."}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment