summaryrefslogtreecommitdiff
path: root/users/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'users/app/models')
-rw-r--r--users/app/models/email.rb8
-rw-r--r--users/app/models/user.rb4
2 files changed, 12 insertions, 0 deletions
diff --git a/users/app/models/email.rb b/users/app/models/email.rb
index 4b01838..0745fda 100644
--- a/users/app/models/email.rb
+++ b/users/app/models/email.rb
@@ -14,4 +14,12 @@ class Email
def to_s
email
end
+
+ def ==(other)
+ other.is_a?(String) ? self.email == other : super
+ end
+
+ def to_param
+ email
+ end
end
diff --git a/users/app/models/user.rb b/users/app/models/user.rb
index 10f358d..d66b0e9 100644
--- a/users/app/models/user.rb
+++ b/users/app/models/user.rb
@@ -45,6 +45,7 @@ class User < CouchRest::Model::Base
view :by_login
view :by_created_at
view :by_email
+
view :by_email_alias,
:map => <<-EOJS
function(doc) {
@@ -56,6 +57,7 @@ class User < CouchRest::Model::Base
});
}
EOJS
+
view :by_email_or_alias,
:map => <<-EOJS
function(doc) {
@@ -70,6 +72,7 @@ class User < CouchRest::Model::Base
});
}
EOJS
+
end
class << self
@@ -127,6 +130,7 @@ class User < CouchRest::Model::Base
end
end
+
##
# Validation Functions
##