Find free username based on schema
The code here seems a bit over complicated for its intended purpose.

Would there be some issue with just appending a random number or hash to the end of each user name? something like taking all the user provided information and creating a sha-1 hash then just using the first 3 or so characters?

data = [fname,lname,fint,lint,urole]
Digest::SHA1.base64digest(data.join('')) 
#=&gt; f1ed8d7c48b27af459240984574c7bcd8b14fe4b


This would give you a very unique string to add to each username.