From 9762a37ab932ee1a94e973977520c7f4673d78b1 Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 13 Dec 2012 16:01:59 +0100 Subject: refactor: allow adding email aliases directly --- users/app/models/user.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'users/app') diff --git a/users/app/models/user.rb b/users/app/models/user.rb index 0eb244c..7c9002b 100644 --- a/users/app/models/user.rb +++ b/users/app/models/user.rb @@ -112,9 +112,16 @@ class User < CouchRest::Model::Base APP_CONFIG['admins'].include? self.login end + def add_email(email) + email = LocalEmail.new({:email => email}) unless email.is_a? Email + email_aliases << email + end + + # this currently only adds the first email address submitted. + # All the ui needs for now. def email_aliases_attributes=(attrs) if attrs - email_alias = Email.new(attrs.values.first) + email_alias = LocalEmail.new(attrs.values.first) email_aliases << email_alias end end -- cgit v1.2.3