summaryrefslogtreecommitdiff
path: root/users/app/models/user.rb
diff options
context:
space:
mode:
Diffstat (limited to 'users/app/models/user.rb')
-rw-r--r--users/app/models/user.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/users/app/models/user.rb b/users/app/models/user.rb
index 413b4ac..dda5a41 100644
--- a/users/app/models/user.rb
+++ b/users/app/models/user.rb
@@ -73,6 +73,19 @@ class User < CouchRest::Model::Base
alias_method :find_by_param, :find
end
+ def create_identity(attribs = {}, &block)
+ build_identity(attribs, &block)
+ identity.save
+ identity
+ end
+
+ def build_identity(attribs = {}, &block)
+ attribs.reverse_merge! user_id: self.id,
+ address: self.email_address,
+ destination: self.email_address
+ Identity.new(attribs, &block)
+ end
+
def to_param
self.id
end