Class: Pulitzer::FreeFormSectionType

Inherits:
ApplicationRecord show all
Includes:
PostTypeElement
Defined in:
app/models/pulitzer/free_form_section_type.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PostTypeElement

#handle_sort_order, #highest_sibling_sort, included

Methods inherited from ApplicationRecord

assoc_name, attrs_name, convert_hash_to_nested

Class Method Details

.convert_nested_assoc(json_hash) ⇒ Object



20
21
22
23
24
25
# File 'app/models/pulitzer/free_form_section_type.rb', line 20

def self.convert_nested_assoc(json_hash)
  json_hash[attrs_name].map!{|p_attrs|
    new_attrs = Pulitzer::PartialType.convert_hash_to_nested p_attrs
  }
  json_hash      
end

.export_configObject



11
12
13
14
15
16
17
18
# File 'app/models/pulitzer/free_form_section_type.rb', line 11

def self.export_config
  {
    except: [:id,:post_type_version_id],
    include: {
      partial_types: PartialType.export_config
    }
  }
end

Instance Method Details

#clone_meObject



31
32
33
34
35
36
# File 'app/models/pulitzer/free_form_section_type.rb', line 31

def clone_me
  clone_attrs = self.attributes.dup
  clone_attrs.delete 'id'
  clone_attrs.delete 'post_type_version_id'
  Pulitzer::FreeFormSectionType.new(clone_attrs)
end

#first_partial_typeObject



27
28
29
# File 'app/models/pulitzer/free_form_section_type.rb', line 27

def first_partial_type
  partial_types.first
end