Module: Spina::Part

Extended by:
ActiveSupport::Concern
Included in:
LayoutPart, PagePart, StructurePart
Defined in:
app/models/concerns/spina/part.rb

Instance Method Summary collapse

Instance Method Details

#contentObject



19
20
21
# File 'app/models/concerns/spina/part.rb', line 19

def content
  self.partable.try(:content)
end

#partable_attributes=(attributes) ⇒ Object



27
28
29
30
31
32
33
# File 'app/models/concerns/spina/part.rb', line 27

def partable_attributes=(attributes)
  if self.partable.present?
    self.partable.assign_attributes(attributes)
  else
    self.partable = self.partable_type.constantize.new(attributes)
  end
end

#to_sObject



15
16
17
# File 'app/models/concerns/spina/part.rb', line 15

def to_s
  name
end

#valueObject



23
24
25
# File 'app/models/concerns/spina/part.rb', line 23

def value
  self.partable.try(:value)
end