Skip to content

Instantly share code, notes, and snippets.

@x37v
Created September 17, 2010 18:05
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 x37v/584651 to your computer and use it in GitHub Desktop.
Save x37v/584651 to your computer and use it in GitHub Desktop.
def check_username_is_allowed
RESTRICTED_NAMES.each do |restricted|
- errors.add(:username, "is not available") if
- username =~ /#{restricted}/i unless errors.on(:username)
+ errors[:username] << "is not available" if
+ username =~ /#{restricted}/i unless errors[:username] and errors[:username].size != 0
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment