Module: ActiveRecordExtended

Defined in:
lib/active_record_extended/ltree_query_methods.rb

Overview

Extends ActiveRecord with ltree query helpers.

WHERE clause operators (<@, @>, ~) are handled by Arel predicates in
config/initializers/arel_ltree_predicates.rb. Use those instead:

Item.where(Item[:pc_path_slugs].ltree_descendant('goods.controls'))
Item.where.not(Item[:pc_path_slugs].ltree_descendant('goods.publications'))
ProductLine.where(ProductLine[:ltree_path_ids].ltree_ancestor('1.2.3'))
ProductLine.where(ProductLine[:ltree_path_slugs].ltree_matches('.tempzone.'))

This file provides:

  • where.ltree_contains -- index()-based containment (no Arel equivalent)
  • where.ltree_depth -- nlevel()-based depth filter
  • Ltree module -- Arel function helpers (nlevel, subpath, lca, etc.)
  • LtreeSelectMethods -- select_ltree_depth, select_ltree_root, etc.
  • order_by_ltree_depth

Defined Under Namespace

Modules: Ltree, LtreeQueryMethods, LtreeSelectMethods