Show only priv contacts

This commit is contained in:
Priit Tark 2015-05-11 15:56:31 +03:00
parent e20de5b793
commit 2ed9672eb5
8 changed files with 28 additions and 3 deletions

View file

@ -69,6 +69,10 @@ class Contact < ActiveRecord::Base
count = find_orphans.destroy_all.count
logger.info "#{Time.zone.now.utc} - Successfully destroyed #{count} orphaned contacts\n"
end
def privs
where("ident_type = '#{PRIV}'")
end
end
def to_s

View file

@ -9,6 +9,7 @@ class Registrar < ActiveRecord::Base
has_many :accounts
has_many :nameservers, through: :domains
has_many :whois_records
has_many :priv_contacts, -> { privs }, class_name: 'Contact'
validates :name, :reg_no, :country_code, :email, :code, presence: true
validates :name, :reg_no, :reference_no, :code, uniqueness: true