diff options
Diffstat (limited to 'users/app/models/email.rb')
-rw-r--r-- | users/app/models/email.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/users/app/models/email.rb b/users/app/models/email.rb index 1bcff1c..a9a503f 100644 --- a/users/app/models/email.rb +++ b/users/app/models/email.rb @@ -3,7 +3,7 @@ class Email < String validates :email, :format => { - :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/, + :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/, #local part of email is case-sensitive, so allow uppercase letter. :message => "needs to be a valid email address" } @@ -19,4 +19,8 @@ class Email < String self end + def handle + self.split('@').first + end + end |