I have a function generate_username that generates a username (obviously).
The values fname and lname are mandatory, so no issues there. However, mname is NOT a mandatory field so, it may be blank, which breaks this code.
Any suggestions on how to ask ruby to only print the mname value if it exists or is set and ignore it if the user left it blank?
def generate_username
self.username = fname.to_s.split("")[0] + mname.to_s.split("")[0] + lname.to_s
end