Class: Spina::LayoutPart

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ApplicationHelper

#captcha, #current_account, #error_explanation!, #image_tag_with_at2x, #link_to_add_fields, #markdown

Instance Attribute Details

#position(theme) ⇒ Object

Returns the value of attribute position.



9
10
11
# File 'app/models/spina/layout_part.rb', line 9

def position
  @position
end

Instance Method Details

#contentObject



27
28
29
# File 'app/models/spina/layout_part.rb', line 27

def content
  self.layout_partable.try(:content) || self.layout_partable
end

#layout_partable_attributes=(attributes) ⇒ Object



31
32
33
34
35
36
37
# File 'app/models/spina/layout_part.rb', line 31

def layout_partable_attributes=(attributes)
  if self.layout_partable.present?
    self.layout_partable.update_attributes(attributes)
  else
    self.layout_partable = self.layout_partable_type.constantize.create(attributes)
  end
end

#partable_typeObject



39
40
41
# File 'app/models/spina/layout_part.rb', line 39

def partable_type
  layout_partable_type
end

#to_sObject



18
19
20
# File 'app/models/spina/layout_part.rb', line 18

def to_s
  name
end