I am working on an application where I need to pass on the anything before "@" sign from the user's email address as his/her first name and last name. For example if the user has an email address "[email protected]" than when the user submits the form I remove "@example.com" from the email and assign "user" as the first and last name.
I have done research but was not able to find a way of doing this in Ruby. Any suggestions ??
You can split on "@" and just use the first part.
email.split("@")[0]
That will give you the first part before the "@".