@ -1,7 +1,7 @@
class SoasController < ApplicationController
active_scaffold :soa do |conf|
conf.columns = [:name, :primary_ns, :contact, :ttl]
conf.create.columns = [:primary_ns, :contact, :ttl]
conf.create.columns = [:contact, :ttl]
conf.update.columns = [:contact, :ttl]
conf.actions.exclude :delete, :show
end
@ -33,19 +33,16 @@ class Domain < ActiveRecord::Base
ns_records.build
soa = soa_record
ns1, ns2 = ns_records
soa.domain = self
soa.contact ||= email
soa.ttl ||= Settings.default_ttl
ns1.domain = self
ns1.content = sample_ns.first
ns1.ttl ||= Settings.default_ttl
ns2.domain = self
ns2.content = sample_ns.second
ns2.ttl ||= Settings.default_ttl
@ -24,6 +24,8 @@ class Record < ActiveRecord::Base
def shortname; name.gsub(/\.?#{self.domain.name}$/, '') end
def shortname=(value); self.name = value end
def to_label; content end
protected
def prepare_name!
@ -18,6 +18,9 @@ class SOA < Record
before_validation :assemble_content
before_update :update_serial
after_initialize :disassemble_content
before_validation do
self.primary_ns ||= domain.ns_records.first.content
# This allows us to have these convenience attributes act like any other
# column in terms of validations