I am wanting to be able to extract from a users email address everything prior to the @. This is what i am going to use to generate a users username.
For example; a user registers with email@example.com, I want to be able to create a username 'ooaat'
Obviously I would need to be able to validate that the username is unique and if not add a number onto the end of 'ooaat1'.
I know with mysql you can use left() function but that would mean I would have to save the email first. Then grab it again with AR and create. Is there another way?
reference on left()