summaryrefslogtreecommitdiff
path: root/users/app/models/user.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-12-18 14:02:31 +0100
committerAzul <azul@leap.se>2012-12-18 14:02:31 +0100
commit76904d3f677520eb191a90f2abb15b9df5fd8ae9 (patch)
tree859e8b9a18bba8ef66988fe75d2de8e2131ab81a /users/app/models/user.rb
parent285b23f39765d8346a658a81eca8b70d70b3e9bf (diff)
make sure we have email_aliases at all before testing for an error on the last
Diffstat (limited to 'users/app/models/user.rb')
-rw-r--r--users/app/models/user.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/users/app/models/user.rb b/users/app/models/user.rb
index 0773f28..1999a28 100644
--- a/users/app/models/user.rb
+++ b/users/app/models/user.rb
@@ -126,7 +126,7 @@ class User < CouchRest::Model::Base
##
def email_differs_from_email_aliases
- return if email_aliases.last.errors.any?
+ return if email_aliases.any? and email_aliases.last.errors.any?
if email_aliases.map(&:email).include?(email)
errors.add(:email, "may not be the same as an alias")
end