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



21
22
23
# File 'app/models/concerns/spina/part.rb', line 21

def content
  (partable || partable_type.constantize.new).content
end

#partable_attributes=(attributes) ⇒ Object



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

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

#to_sObject



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

def to_s
  name
end

#valueObject



25
26
27
# File 'app/models/concerns/spina/part.rb', line 25

def value
  partable.try(:value)
end