15 lines
543 B
Ruby
15 lines
543 B
Ruby
class Domain < ApplicationRecord
|
|
after_create :create_abuse_postmaster
|
|
|
|
has_many :credentials, dependent: :destroy
|
|
has_many :virtuals, dependent: :destroy
|
|
validates :domain, presence: true
|
|
validates :domain, uniqueness: true
|
|
|
|
private
|
|
def create_abuse_postmaster
|
|
Virtual.create(email: "abuse@#{self.domain}", destination: "jez@warwickhunt.com", domain_id: self.id)
|
|
Virtual.create(email: "postmaster@#{self.domain}", destination: "jez@warwickhunt.com", domain_id: self.id)
|
|
end
|
|
end
|