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

  validate :unique_on_server

  def to_partial_path
    "emails/email"
  end

  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