Class: Ecoportal::API::V2::Page::Stage

Inherits:
Common::Content::DoubleModel show all
Defined in:
lib/ecoportal/api/v2/page/stage.rb

Constant Summary

Constants inherited from Common::Content::DoubleModel

Common::Content::DoubleModel::NOT_USED

Constants included from Common::Content::ClassHelpers

Common::Content::ClassHelpers::NOT_USED

Instance Attribute Summary

Attributes inherited from Common::Content::DoubleModel

#_key, #_parent

Instance Method Summary collapse

Methods inherited from Common::Content::DoubleModel

#_doc_key, #as_json, #as_update, #consolidate!, #dirty?, #doc, embeds_multiple, embeds_one, #initialize, #key, #key=, key?, new_uuid, #original_doc, pass_reader, pass_writer, passarray, passdate, passkey, passthrough, #pretty_print, #replace_doc, #reset!, #root, #to_json

Methods included from Common::Content::ClassHelpers

#instance_variable_name, #new_class, #resolve_class, #to_constant, #to_time, #used_param?

Constructor Details

This class inherits a constructor from Ecoportal::API::Common::Content::DoubleModel

Instance Method Details

#attach_section(section) ⇒ Object



21
22
23
# File 'lib/ecoportal/api/v2/page/stage.rb', line 21

def attach_section(section)
  section_ids.insert_one(section.id)
end

#sectionsObject



13
14
15
16
17
18
19
# File 'lib/ecoportal/api/v2/page/stage.rb', line 13

def sections
  sec_ids = section_ids.to_a
  root.sections.values_at(*sec_ids).select.with_index do |sec, i|
    puts "Warning: section #{id} points to missing section #{sec_ids[i]}" if !sec
    fld && (!block_given? || yield(sec))
  end.sort_by {|sec| sec.weight}
end