Class: Spina::StructurePart

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/spina/structure_part.rb

Instance Method Summary collapse

Instance Method Details

#contentObject



17
18
19
# File 'app/models/spina/structure_part.rb', line 17

def content
  structure_partable.try(:content) || structure_partable
end

#structure_partable_attributes=(attributes) ⇒ Object



21
22
23
24
25
26
27
# File 'app/models/spina/structure_part.rb', line 21

def structure_partable_attributes=(attributes)
  if self.structure_partable.present?
    self.structure_partable.assign_attributes(attributes)
  else
    self.structure_partable = self.structure_partable_type.constantize.new(attributes)
  end
end

#to_sObject



13
14
15
# File 'app/models/spina/structure_part.rb', line 13

def to_s
  name
end