Find free username based on schema

Hopefully this is not too complicated. I have this code that will generate a username based on the pre-configured schema the admin types in. The fields they can use are:

<first_initial>
<last_initial>
<first_name>
<last_name>
<role>


So, if my name were John Doe, and I had the role of "author" in the system, the function would translate these UsernameSchema thusly:

<first_name>.<last_name>         = john.doe
<first_intitial><last_name>      = jdoe
<first_name>.<last_name>-<role>  = john.doe-author
<last_initial>                   = d


Obviously, it needs to check for duplicates. Below is the working code I have (will be called either after_initialize or before_create (not sure which at this point):

  def set_username
schema = UsernameSchema.where(:active => true).first! || "<first_initial><last_name>"
fname = self.first_name
lname = self.last_name
finit = fname[0]
linit = lname[0]
urole = self.role
# Question 2:
replacement_dict = {"<first_initial>" => finit, "<last_initial>" => linit, "<first_name>" => fname, "<last_name>" => lname, "<role>" => urole}
replacement_regex= /(<first_initial>)|(<last_initial>)|(<first_name>)|(<last_name>)|(<role>)/
end

# Question 3, IDE complains about next line
def find_free_name(un)
if user
num = user.scan(/\d+\$/).first
if num
new_num = num.to_i + 1
next_user = un.gsub(num, new_num.to_s)
else
next_user = un + "1"
end
find_free_name(next_user)
else
un
end
end


I guess I have these concerns with my code:

1. Is this a dumb way of doing it?
2. Where my "Question 2" comment is in the above code, that seems redundant... is there a more succinct way?
3. My IDE says I'm doing it wrong (and I don't know what it wants):

All custom “finds” accessed from more than one place in the code use named_scope instead of a custom method.

data = [fname,lname,fint,lint,urole]