activerecord-cte 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/activerecord/cte/core_ext.rb +23 -0
- data/lib/activerecord/cte/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2fbfad4eca9d8be81cde9c22367e6cf29020baad9411acfffe4abe2f51d99fe
|
4
|
+
data.tar.gz: 39cacb9b310c315c5e0fff63a88903e69b4a618b324f0bcabfe78f4b70530a01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1a1428a7916fd20c25d758a68cbcc9d39c3e737e462b01467226cc4a7fec68ad86fce2aadd7c2452170979cd8e7bff6fc0026e51a15a886e4bee8ea42eb6332
|
7
|
+
data.tar.gz: 488b14ed1cff2d0271188eeb0457432a38eb51637c44d4e2015ca1624ee646c42b426a7cb8f583b94f8baadc2e90abf2fd59d5aa3bc8d70b3c5a22746c631457
|
@@ -4,8 +4,31 @@ module ActiveRecord
|
|
4
4
|
module Querying
|
5
5
|
delegate :with, to: :all
|
6
6
|
end
|
7
|
+
|
8
|
+
module WithMerger
|
9
|
+
def normal_values
|
10
|
+
super + %i[with]
|
11
|
+
end
|
12
|
+
|
13
|
+
def merge
|
14
|
+
super
|
15
|
+
merge_withs
|
16
|
+
relation
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def merge_withs
|
22
|
+
other_values = other.with_values.reject { |value| relation.with_values.include?(value) }
|
23
|
+
relation.with!(*other_values) if other_values.any?
|
24
|
+
end
|
25
|
+
end
|
7
26
|
|
8
27
|
class Relation
|
28
|
+
class Merger
|
29
|
+
prepend WithMerger
|
30
|
+
end
|
31
|
+
|
9
32
|
def with(opts, *rest)
|
10
33
|
spawn.with!(opts, *rest)
|
11
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-cte
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vlado Cingel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|