Validate uniqueness manually all the time

This commit is contained in:
Martin Lensment 2014-10-01 10:42:49 +03:00
parent 0ab1e29a53
commit 3f8f5cc4cd
5 changed files with 17 additions and 14 deletions

View file

@ -18,7 +18,6 @@ class DomainContact < ActiveRecord::Base
TYPES = [TECH, ADMIN]
validates :contact, presence: true
validates :contact, uniqueness: { scope: [:domain_id, :contact_type] }
scope :admin, -> { where(contact_type: ADMIN) }
scope :tech, -> { where(contact_type: TECH) }