Skip to content

Commit

Permalink
Merge pull request #67 from JuzerShakir/active_record_union
Browse files Browse the repository at this point in the history
Remove `active_record_union` dependency
  • Loading branch information
JuzerShakir authored Dec 19, 2024
2 parents 786b832 + 5bd2935 commit 3c4ed71
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
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

0 comments on commit 3c4ed71

Please # to comment.