Skip to content

Commit 3c4ed71

Browse files
authored
Merge pull request #67 from JuzerShakir/active_record_union
Remove `active_record_union` dependency
2 parents 786b832 + 5bd2935 commit 3c4ed71

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ ruby "~> 3.3.6"
55

66
gem "rails", "~> 8.0.1"
77

8-
gem "active_record_union", github: "brianhempel/active_record_union", branch: "master"
98
gem "bcrypt", "~> 3.1.20"
109
gem "bootsnap", require: false
1110
gem "cancancan", "~> 3.6.1"

Gemfile.lock

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
GIT
2-
remote: https://github.com/brianhempel/active_record_union.git
3-
revision: 8ebe558709aabe039abd24e3e7dd4d4354a6de88
4-
branch: master
5-
specs:
6-
active_record_union (1.3.0)
7-
activerecord (>= 6.0)
8-
91
GEM
102
remote: https://rubygems.org/
113
specs:
@@ -401,7 +393,6 @@ PLATFORMS
401393
x86_64-linux
402394

403395
DEPENDENCIES
404-
active_record_union!
405396
bcrypt (~> 3.1.20)
406397
bootsnap
407398
brakeman
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module ActiveRecordRelationExtensions
2+
refine ActiveRecord::Relation do
3+
def union(q)
4+
union_query = Arel::Nodes::Union.new(arel, q.arel).as(klass.table_name)
5+
klass.from(union_query)
6+
end
7+
end
8+
end

app/models/sabeel.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def sluggables = [its]
2727
include ITSValidation
2828
include NameValidation
2929

30+
using ActiveRecordRelationExtensions
3031
using ArrayExtensions
3132

3233
# * Enums

app/models/thaali.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class Thaali < ApplicationRecord
2323

2424
def sluggables = [year, number]
2525

26+
using ActiveRecordRelationExtensions
2627
using ArrayExtensions
2728

2829
# * Enums

0 commit comments

Comments
 (0)