app/models/user.rb
# -------------------------------------------------------------
# Gets the username (without the domain) of the e-mail address, if possible.
Gets the username (without the domain) of the e-mail address, if possible.
Gets the username ( without the domain ) of the e - mail address if possible .
def email_without_domain
    if email =~ /(^[^@]+)@/
      $1
    else
      email
    end
  end
def email_without_domain if email =~ / (^[^@]+)@ / $1 else email end end
Gets the username (without the domain) of the e-mail address, if possible.
Gets the username ( without the domain ) of the e - mail address if possible .