summaryrefslogtreecommitdiff
path: root/users/app/models/local_email.rb
blob: 5762a337b89eb825d42c0564404bd90155124b35 (plain)
1
2
3
4
5
6
7
8
9
10
11
class LocalEmail < Email

  validate :unique_on_server

  def unique_on_server
     has_email = User.find_by_email_or_alias(email)
     if has_email && has_email != self.base_doc
      errors.add(:email, "has already been taken")
    end
  end
end