
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
A simplistic gem that allows ActiveRecord models to be organized in a tree or hierarchy. It uses a materialized path implementation based around PostgreSQL's ltree data type, associated functions and operators.
Add this line to your application's Gemfile:
gem 'ltree_hierarchy'
And then execute:
$ bundle
Add ltree extension to PostgreSQL:
$ psql -U postgres -d my_database
-> CREATE EXTENSION IF NOT EXISTS ltree;
Update your table:
class AddLtreeToLocations < ActiveRecord::Migration
def self.up
add_column :locations, :parent_id, :integer
add_column :locations, :path, :ltree
add_index :locations, :parent_id
end
def self.down
remove_index :locations, :parent_id
remove_column :locations, :parent_id
remove_column :locations, :path
end
end
Run migrations:
$ bundle exec rake db:migrate
class Location < ActiveRecord::Base
has_ltree_hierarchy
end
root = Location.create!(name: 'UK')
child = Location.create!(name: 'London', parent: root)
subchild = Location.create!(name: 'Hackney', parent: child)
root.parent # => nil
child.parent # => root
root.children # => [child]
root.children.first.children.first # => subchild
subchild.root # => root
.roots
.leaves
.at_depth(n)
.lowest_common_ancestors(scope)
#parent
#ancestors
#self_and_ancestors
#siblings
#self_and_siblings
#children
#self_and_children
#descendants
#self_and_descendants
#leaves
FAQs
Unknown package
We found that ltree_hierarchy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.