Class: PDNS::ApplicationRecord

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/pdns/application_record.rb

Direct Known Subclasses

Domain, Record

Instance Method Summary collapse

Instance Method Details

#as_json(options = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'app/models/pdns/application_record.rb', line 6

def as_json(options = nil)
  resource = self.class.name.split('::').last
  method = :"#{resource.downcase}_as_json"

  if PDNS.respond_to?(method) && PDNS.send(method).present?
    PDNS.send(method).call(attributes, options)
  else
    super
  end
end