Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove active_record_union dependency #67

Merged
merged 4 commits into from
Dec 19, 2024
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
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ ruby "~> 3.3.6"

gem "rails", "~> 8.0.1"

gem "active_record_union", github: "brianhempel/active_record_union", branch: "master"
gem "bcrypt", "~> 3.1.20"
gem "bootsnap", require: false
gem "cancancan", "~> 3.6.1"
Expand Down
9 changes: 0 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
GIT
remote: https://github.com/brianhempel/active_record_union.git
revision: 8ebe558709aabe039abd24e3e7dd4d4354a6de88
branch: master
specs:
active_record_union (1.3.0)
activerecord (>= 6.0)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -401,7 +393,6 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
active_record_union!
bcrypt (~> 3.1.20)
bootsnap
brakeman
Expand Down
8 changes: 8 additions & 0 deletions app/models/concerns/active_record_relation_extensions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module ActiveRecordRelationExtensions
refine ActiveRecord::Relation do
def union(q)
union_query = Arel::Nodes::Union.new(arel, q.arel).as(klass.table_name)
klass.from(union_query)
end
end
end
1 change: 1 addition & 0 deletions app/models/sabeel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def sluggables = [its]
include ITSValidation
include NameValidation

using ActiveRecordRelationExtensions
using ArrayExtensions

# * Enums
Expand Down
1 change: 1 addition & 0 deletions app/models/thaali.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Thaali < ApplicationRecord

def sluggables = [year, number]

using ActiveRecordRelationExtensions
using ArrayExtensions

# * Enums
Expand Down
Loading