Module: Locomotive::Concerns::Page::Tree::PatchedTreeMethods

Defined in:
app/models/locomotive/concerns/page/tree.rb

Instance Method Summary collapse

Instance Method Details

#ancestorsObject



32
33
34
35
# File 'app/models/locomotive/concerns/page/tree.rb', line 32

def ancestors
  # https://github.com/benhutton/mongoid-tree/commit/acb6eb0440dc003cd8536cb8cc6ff4b16c9c9402
  super.order_by(:depth.asc)
end

#siblings_and_selfMongoid::Criteria

Returns this document’s siblings and itself, all scoped by the site

Returns:

  • (Mongoid::Criteria)

    Mongoid criteria to retrieve the document’s siblings and itself



41
42
43
# File 'app/models/locomotive/concerns/page/tree.rb', line 41

def siblings_and_self
  base_class.where(parent_id: self.parent_id, site_id: self.site_id)
end