summaryrefslogtreecommitdiff
path: root/users/app/models/email.rb
diff options
context:
space:
mode:
Diffstat (limited to 'users/app/models/email.rb')
-rw-r--r--users/app/models/email.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/users/app/models/email.rb b/users/app/models/email.rb
index 45101c1..4b01838 100644
--- a/users/app/models/email.rb
+++ b/users/app/models/email.rb
@@ -6,6 +6,11 @@ class Email
validates :email,
:format => { :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/, :message => "needs to be a valid email address"}
+ def initialize(attributes = nil, &block)
+ attributes = {:email => attributes} if attributes.is_a? String
+ super(attributes, &block)
+ end
+
def to_s
email
end