Module: Pulitzer::PostTypeElement

Included in:
FreeFormSectionType, PostTypeContentElementType
Defined in:
app/models/pulitzer/post_type_element.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



3
4
5
# File 'app/models/pulitzer/post_type_element.rb', line 3

def self.included(klass)
  klass.before_save :handle_sort_order
end

Instance Method Details

#handle_sort_orderObject



11
12
13
# File 'app/models/pulitzer/post_type_element.rb', line 11

def handle_sort_order
  self.sort_order ||= self.highest_sibling_sort + 1
end

#highest_sibling_sortObject



7
8
9
# File 'app/models/pulitzer/post_type_element.rb', line 7

def highest_sibling_sort
  self.post_type_version.highest_element_sort
end