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
80 changes: 51 additions & 29 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,20 @@ jobs:
matrix:
versions:
[
{ ruby: "3.4", rails: 8_1, arelx: 2 },
{ ruby: "3.4", rails: 8, arelx: 2 },
{ ruby: "3.4", rails: 7_2, arelx: 2 },
{ ruby: "3.4", rails: 7_1, arelx: 2 },
{ ruby: "3.4", rails: 7, arelx: 2 },
{ ruby: "3.4", rails: 6_1, arelx: 2 },
{ ruby: "3.3", rails: 8_1, arelx: 2 },
{ ruby: "3.3", rails: 8, arelx: 2 },
{ ruby: "3.3", rails: 7_2, arelx: 2 },
{ ruby: "3.3", rails: 7_1, arelx: 2 },
{ ruby: "3.3", rails: 7, arelx: 2 },
{ ruby: "3.3", rails: 6_1, arelx: 2 },
{ ruby: "3.2", rails: 8_1, arelx: 2 },
{ ruby: "3.2", rails: 8, arelx: 2 },
{ ruby: "3.2", rails: 7_2, arelx: 2 },
{ ruby: "3.2", rails: 7_1, arelx: 2 },
{ ruby: "3.2", rails: 7, arelx: 2 },
Expand All @@ -46,11 +56,6 @@ jobs:
{ ruby: "2.7", rails: 6_1, arelx: 2 },
{ ruby: "2.7", rails: 6, arelx: 2 },
{ ruby: "2.7", rails: 5_2, arelx: 1 },
{ ruby: "2.7", rails: 4_2, arelx: 1 },
{ ruby: "2.5", rails: 6_1, arelx: 2 },
{ ruby: "2.5", rails: 6, arelx: 2 },
{ ruby: "2.5", rails: 5_2, arelx: 1 },
{ ruby: "2.5", rails: 4_2, arelx: 1 },
Comment on lines -50 to -53
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

{ ruby: jruby-9.2, rails: 6_1, arelx: 2 },
{ ruby: jruby-9.2, rails: 6, arelx: 2 },
{ ruby: jruby-9.2, rails: 5_2, arelx: 1 },
Expand Down Expand Up @@ -88,10 +93,20 @@ jobs:
matrix:
versions:
[
{ ruby: "3.4", rails: 8_1, arelx: 2 },
{ ruby: "3.4", rails: 8, arelx: 2 },
{ ruby: "3.4", rails: 7_2, arelx: 2 },
{ ruby: "3.4", rails: 7_1, arelx: 2 },
{ ruby: "3.4", rails: 7, arelx: 2 },
{ ruby: "3.4", rails: 6_1, arelx: 2 },
{ ruby: "3.3", rails: 8_1, arelx: 2 },
{ ruby: "3.3", rails: 8, arelx: 2 },
{ ruby: "3.3", rails: 7_2, arelx: 2 },
{ ruby: "3.3", rails: 7_1, arelx: 2 },
{ ruby: "3.3", rails: 7, arelx: 2 },
{ ruby: "3.3", rails: 6_1, arelx: 2 },
{ ruby: "3.2", rails: 8_1, arelx: 2 },
{ ruby: "3.2", rails: 8, arelx: 2 },
{ ruby: "3.2", rails: 7_2, arelx: 2 },
{ ruby: "3.2", rails: 7_1, arelx: 2 },
{ ruby: "3.2", rails: 7, arelx: 2 },
Expand All @@ -110,15 +125,9 @@ jobs:
{ ruby: "2.7", rails: 6_1, arelx: 2 },
{ ruby: "2.7", rails: 6, arelx: 2 },
{ ruby: "2.7", rails: 5_2, arelx: 1 },
{ ruby: "2.7", rails: 4_2, arelx: 1 },
{ ruby: "2.5", rails: 6_1, arelx: 2 },
{ ruby: "2.5", rails: 6, arelx: 2 },
{ ruby: "2.5", rails: 5_2, arelx: 1 },
{ ruby: "2.5", rails: 4_2, arelx: 1 },
{ ruby: jruby-9.2, rails: 6_1, arelx: 2 },
{ ruby: jruby-9.2, rails: 6, arelx: 2 },
{ ruby: jruby-9.2, rails: 5_2, arelx: 1 },
{ ruby: jruby-9.2, rails: 4_2, arelx: 1 },
{ ruby: jruby-9.3, rails: 6_1, arelx: 2 },
{ ruby: jruby-9.3, rails: 6, arelx: 2 },
{ ruby: jruby-9.3, rails: 5_2, arelx: 1 },
Expand Down Expand Up @@ -152,10 +161,20 @@ jobs:
fail-fast: false
matrix:
versions: [
{ ruby: "3.4", rails: 8_1, arelx: 2 },
{ ruby: "3.4", rails: 8, arelx: 2 },
{ ruby: "3.4", rails: 7_2, arelx: 2 },
{ ruby: "3.4", rails: 7_1, arelx: 2 },
{ ruby: "3.4", rails: 7, arelx: 2 },
{ ruby: "3.4", rails: 6_1, arelx: 2 },
{ ruby: "3.3", rails: 8_1, arelx: 2 },
{ ruby: "3.3", rails: 8, arelx: 2 },
{ ruby: "3.3", rails: 7_2, arelx: 2 },
{ ruby: "3.3", rails: 7_1, arelx: 2 },
{ ruby: "3.3", rails: 7, arelx: 2 },
{ ruby: "3.3", rails: 6_1, arelx: 2 },
{ ruby: "3.2", rails: 8_1, arelx: 2 },
{ ruby: "3.2", rails: 8, arelx: 2 },
{ ruby: "3.2", rails: 7_2, arelx: 2 },
{ ruby: "3.2", rails: 7_1, arelx: 2 },
{ ruby: "3.2", rails: 7, arelx: 2 },
Expand All @@ -174,15 +193,9 @@ jobs:
{ ruby: "2.7", rails: 6_1, arelx: 2 },
{ ruby: "2.7", rails: 6, arelx: 2 },
{ ruby: "2.7", rails: 5_2, arelx: 1 },
{ ruby: "2.7", rails: 4_2, arelx: 1 },
{ ruby: "2.5", rails: 6_1, arelx: 2 },
{ ruby: "2.5", rails: 6, arelx: 2 },
{ ruby: "2.5", rails: 5_2, arelx: 1 },
{ ruby: "2.5", rails: 4_2, arelx: 1 },
{ ruby: jruby-9.2, rails: 6_1, arelx: 2 },
{ ruby: jruby-9.2, rails: 6, arelx: 2 },
{ ruby: jruby-9.2, rails: 5_2, arelx: 1 },
{ ruby: jruby-9.2, rails: 4_2, arelx: 1 },
{ ruby: jruby-9.3, rails: 6_1, arelx: 2 },
{ ruby: jruby-9.3, rails: 6, arelx: 2 },
{ ruby: jruby-9.3, rails: 5_2, arelx: 1 },
Expand Down Expand Up @@ -241,10 +254,20 @@ jobs:
fail-fast: false
matrix:
versions: [
{ ruby: "3.4", rails: 8_1, arelx: 2 },
{ ruby: "3.4", rails: 8, arelx: 2 },
{ ruby: "3.4", rails: 7_2, arelx: 2 },
{ ruby: "3.4", rails: 7_1, arelx: 2 },
{ ruby: "3.4", rails: 7, arelx: 2 },
{ ruby: "3.4", rails: 6_1, arelx: 2 },
{ ruby: "3.3", rails: 8_1, arelx: 2 },
{ ruby: "3.3", rails: 8, arelx: 2 },
{ ruby: "3.3", rails: 7_2, arelx: 2 },
{ ruby: "3.3", rails: 7_1, arelx: 2 },
{ ruby: "3.3", rails: 7, arelx: 2 },
{ ruby: "3.3", rails: 6_1, arelx: 2 },
{ ruby: "3.2", rails: 8_1, arelx: 2 },
{ ruby: "3.2", rails: 8, arelx: 2 },
{ ruby: "3.2", rails: 7_2, arelx: 2 },
{ ruby: "3.2", rails: 7_1, arelx: 2 },
{ ruby: "3.2", rails: 7, arelx: 2 },
Expand All @@ -263,15 +286,9 @@ jobs:
{ ruby: "2.7", rails: 6_1, arelx: 2 },
{ ruby: "2.7", rails: 6, arelx: 2 },
{ ruby: "2.7", rails: 5_2, arelx: 1 },
{ ruby: "2.7", rails: 4_2, arelx: 1 },
{ ruby: "2.5", rails: 6_1, arelx: 2 },
{ ruby: "2.5", rails: 6, arelx: 2 },
{ ruby: "2.5", rails: 5_2, arelx: 1 },
{ ruby: "2.5", rails: 4_2, arelx: 1 },
{ ruby: jruby-9.2, rails: 6_1, arelx: 2 },
{ ruby: jruby-9.2, rails: 6, arelx: 2 },
{ ruby: jruby-9.2, rails: 5_2, arelx: 1 },
{ ruby: jruby-9.2, rails: 4_2, arelx: 1 },
{ ruby: jruby-9.3, rails: 6_1, arelx: 2 },
{ ruby: jruby-9.3, rails: 6, arelx: 2 },
{ ruby: jruby-9.3, rails: 5_2, arelx: 1 },
Expand Down Expand Up @@ -352,10 +369,21 @@ jobs:
fail-fast: false
matrix:
versions: [
{ ruby: "3.4", rails: 8_1, arelx: 2 },
{ ruby: "3.4", rails: 8, arelx: 2 },
{ ruby: "3.4", rails: 7_2, arelx: 2 },
{ ruby: "3.4", rails: 7_1, arelx: 2 },
{ ruby: "3.4", rails: 7, arelx: 2 },
{ ruby: "3.4", rails: 6_1, arelx: 2 },
{ ruby: "3.3", rails: 8_1, arelx: 2 },
{ ruby: "3.3", rails: 8, arelx: 2 },
{ ruby: "3.3", rails: 7_2, arelx: 2 },
{ ruby: "3.3", rails: 7_1, arelx: 2 },
{ ruby: "3.3", rails: 7, arelx: 2 },
{ ruby: "3.3", rails: 6_1, arelx: 2 },
{ ruby: "3.3", rails: 6, arelx: 2 },
{ ruby: "3.2", rails: 8_1, arelx: 2 },
{ ruby: "3.2", rails: 8, arelx: 2 },
{ ruby: "3.2", rails: 7_1, arelx: 2 },
{ ruby: "3.2", rails: 7, arelx: 2 },
{ ruby: "3.2", rails: 6_1, arelx: 2 },
Expand All @@ -370,15 +398,9 @@ jobs:
{ ruby: "2.7", rails: 6_1, arelx: 2 },
{ ruby: "2.7", rails: 6, arelx: 2 },
{ ruby: "2.7", rails: 5_2, arelx: 1 },
{ ruby: "2.7", rails: 4_2, arelx: 1 },
{ ruby: "2.5", rails: 6_1, arelx: 2 },
{ ruby: "2.5", rails: 6, arelx: 2 },
{ ruby: "2.5", rails: 5_2, arelx: 1 },
{ ruby: "2.5", rails: 4_2, arelx: 1 },
# {ruby: jruby-9.2, rails: 6_1, arelx: 2},
# {ruby: jruby-9.2, rails: 6, arelx: 2},
{ ruby: jruby-9.2, rails: 5_2, arelx: 1 },
{ ruby: jruby-9.2, rails: 4_2, arelx: 1 },
# See comments on 9.4 to understand why these are disabled for now.
# {ruby: jruby-9.3, rails: 6_1, arelx: 2},
# {ruby: jruby-9.3, rails: 6, arelx: 2},
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## [unreleased]

- Drop supoprt for Ruby < 2.7.
- Drop support for Rails < 5.2.
- Add support for Rails 8 and 8.1.
- Add `byte_size` and `char_length`. They should replace all uses of `length` because it's inconsistent across vendors; it can surprise you and give you byte size when you expect string length.

## Release v2.3.3/v1.5.3 (11-02-2025)
Expand Down
20 changes: 0 additions & 20 deletions gemfiles/rails3.gemfile

This file was deleted.

38 changes: 0 additions & 38 deletions gemfiles/rails4_2.gemfile

This file was deleted.

40 changes: 40 additions & 0 deletions gemfiles/rails8.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
source 'https://rubygems.org'

gem 'rails', '~> 8.0'

group :development, :test do
gem 'ruby-lsp', platforms: %i[mri]
gem 'debug', platforms: %i[mri]

gem 'activesupport', '~> 8.0'
gem 'activemodel', '~> 8.0'
gem 'activerecord', '~> 8.0'

gem 'sqlite3', '~> 2.1', platforms: [:mri]
gem 'mysql2', '~>0.5', platforms: [:mri]
gem 'pg', '~> 1.5', platforms: [:mri]

gem 'tiny_tds', platforms: %i[mri mingw x64_mingw mswin]
gem 'activerecord-sqlserver-adapter', '~> 8.0', platforms: %i[mri mingw x64_mingw mswin]
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw]

gem 'ruby-oci8', platforms: %i[mri mswin mingw] if ENV.has_key? 'ORACLE_HOME'
gem 'activerecord-oracle_enhanced-adapter', '~> 8.0' if ENV.has_key? 'ORACLE_HOME'

# for JRuby
gem 'jdbc-mssql', platforms: :jruby, require: true
gem 'jdbc-sqlite3', platform: :jruby
gem 'activerecord-jdbcmysql-adapter', platforms: :jruby
gem 'activerecord-jdbcpostgresql-adapter', platforms: :jruby
gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby

# Ruby 3.4+ removes the following gems from the standard distribution.
# Warnings are emitted from 3.3.
if Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('3.3.0')
gem 'base64'
gem 'bigdecimal'
gem 'mutex_m'
end
end

gemspec path: Dir.pwd
41 changes: 41 additions & 0 deletions gemfiles/rails8_1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
source 'https://rubygems.org'

gem 'rails', '~> 8.1'

group :development, :test do
gem 'ruby-lsp', platforms: %i[mri]
gem 'debug', platforms: %i[mri]

gem 'activesupport', '~> 8.1'
gem 'activemodel', '~> 8.1'
gem 'activerecord', '~> 8.1'

gem 'sqlite3', '~> 2.1', platforms: [:mri]
gem 'mysql2', '~>0.5', platforms: [:mri]
gem 'pg', '~> 1.5', platforms: [:mri]

gem 'tiny_tds', platforms: %i[mri mingw x64_mingw mswin]
gem 'activerecord-sqlserver-adapter', '~> 8.1', platforms: %i[mri mingw x64_mingw mswin]
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw]

gem 'ruby-oci8', platforms: %i[mri mswin mingw] if ENV.has_key? 'ORACLE_HOME'
# gem 'activerecord-oracle_enhanced-adapter', '~> 8.1.0' if ENV.has_key? 'ORACLE_HOME'

# for JRuby
gem 'jdbc-mssql', platforms: :jruby, require: true
gem 'jdbc-sqlite3', platform: :jruby
# gem 'activerecord-jdbc-alt-adapter', '~> 71.0.0.alpha1', platform: :jruby, require: true
gem 'activerecord-jdbcmysql-adapter', platforms: :jruby
gem 'activerecord-jdbcpostgresql-adapter', platforms: :jruby
gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby

# Ruby 3.4+ removes the following gems from the standard distribution.
# Warnings are emitted from 3.3.
if Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('3.3.0')
gem 'base64'
gem 'bigdecimal'
gem 'mutex_m'
end
end

gemspec path: Dir.pwd
21 changes: 15 additions & 6 deletions lib/arel_extensions.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'arel'
require 'arel_extensions/constants'
require 'base64'

require 'arel_extensions/railtie' if defined?(Rails::Railtie)
Expand All @@ -17,7 +18,7 @@ class Arel::Nodes::Casted
include Arel::AliasPredication

# They forget to define hash.
if Gem::Version.new(Arel::VERSION) < Gem::Version.new('10.0.0')
if ArelExtensions::AREL_VERSION < ArelExtensions::V10
def hash
[self.class, self.val, self.attribute].hash
end
Expand Down Expand Up @@ -45,7 +46,7 @@ class Arel::Nodes::Function
include Arel::Expressions
end

if Gem::Version.new(Arel::VERSION) >= Gem::Version.new('7.1.0')
if ArelExtensions::AREL_VERSION >= ArelExtensions::V7_1
class Arel::Nodes::Case
include Arel::Math
include Arel::Expressions
Expand Down Expand Up @@ -199,12 +200,20 @@ class Arel::Nodes::Function
include ArelExtensions::NullFunctions
include ArelExtensions::Predications

if ArelExtensions::ACTIVE_RECORD_VERSION >= ArelExtensions::V8_1
attr_accessor :alias
alias_method :old_initialize, :initialize

def initialize(expr, aliaz = nil)
old_initialize(expr)
self.alias = aliaz
end
end

alias_method(:old_as, :as) rescue nil
def as other
res = Arel::Nodes::As.new(self.clone, Arel.sql(other))
if Gem::Version.new(Arel::VERSION) >= Gem::Version.new('9.0.0')
self.alias = Arel.sql(other)
end
self.alias = Arel.sql(other)
res
end
end
Expand Down Expand Up @@ -325,7 +334,7 @@ def rollup
end

require 'active_record'
if ActiveRecord.version >= Gem::Version.create('7.2')
if ArelExtensions::ACTIVE_RECORD_VERSION >= ArelExtensions::V7_2
class ActiveRecord::Relation::WhereClause
def except_predicates(columns)
attrs = columns.extract! { |node| node.is_a?(Arel::Attribute) }
Expand Down
Loading