class Pina::Models::DocumentPairing
Public Class Methods
new(attributes = {}, *args)
click to toggle source
Calls superclass method
# File lib/pina/models/document_pairing.rb, line 17 def initialize(attributes = {}, *args) extend(Virtus.model) document_type = attributes.symbolize_keys[:document_pairable_type] document_pairable_attribute(document_type) super end
Private Instance Methods
document_klass(document_type)
click to toggle source
# File lib/pina/models/document_pairing.rb, line 34 def document_klass(document_type) model = document_type.camelize return unless Pina::Models.const_defined?(model) Pina::Models.const_get(model) end
document_pairable_attribute(document_type)
click to toggle source
# File lib/pina/models/document_pairing.rb, line 28 def document_pairable_attribute(document_type) return unless document_type attribute(:document_pairable, document_klass(document_type)) end