Browse Source

refactor

pull/1/head
Nicolae Claudius 13 years ago
parent
commit
36c3d976a3
  1. 4
      app/controllers/soas_controller.rb
  2. 5
      app/models/domain.rb
  3. 5
      app/models/soa.rb

4
app/controllers/soas_controller.rb

@ -23,8 +23,6 @@ class SoasController < ApplicationController
end
def after_update_save(record)
unless @record.domain.ns_records.any? {|ns_record| @record.primary_ns == ns_record.content}
flash.now[:warning] = "SOA record's primary NS is no longer among this domain's NS records"
end
flash.now[:warning] = "SOA record's primary NS is no longer among this domain's NS records" unless record.ns?
end
end

5
app/models/domain.rb

@ -120,6 +120,11 @@ class Domain < ActiveRecord::Base
Settings.host_domains.include?(name)
end
# domain.has_ns?('129.168.0.1')
def has_ns?(ns)
ns_records.any? {|ns_record| ns_record.content == ns}
end
def setup(email)
build_soa_record
soa = soa_record

5
app/models/soa.rb

@ -63,6 +63,11 @@ class SOA < Record
update_serial
save
end
# if SOA record's primary NS is among it's domain's NS records
def ns?
domain.has_ns?(primary_ns)
end
def to_label; "#{primary_ns} #{contact}" end

Loading…
Cancel
Save