Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
test:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:17-alpine
Expand All @@ -26,7 +26,7 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5

mysql:
image: mysql:8
ports:
Expand All @@ -47,6 +47,7 @@ jobs:
- '3.4'
rails:
- '8.0'
- '8.1.0.rc1'

steps:
- name: Checkout
Expand Down
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ source 'https://rubygems.org'
gemspec

gem 'dotenv'
gem 'railties'
gem 'with_advisory_lock', '>= 7'

gem 'activerecord', "~> #{ENV['RAILS_VERSION'] || '8.0'}"
rails_version = ENV['RAILS_VERSION'] || '8.0'
gem 'activerecord', "~> #{rails_version}"
gem 'railties', "~> #{rails_version}"

platforms :mri, :truffleruby do
# Database adapters
Expand Down
3 changes: 3 additions & 0 deletions lib/closure_tree/support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def hierarchy_class_for_model
hierarchy_class = parent_class.const_set(short_hierarchy_class_name, Class.new(model_class.superclass))
model_class_name = model_class.to_s
hierarchy_class.class_eval do
# Rails 8.1+ requires an implicit_order_column for models without a primary key
self.implicit_order_column = 'ancestor_id'

belongs_to :ancestor, class_name: model_class_name
belongs_to :descendant, class_name: model_class_name
def ==(other)
Expand Down