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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99aec3bf8a3947e2c887a63ca0b2d689987774c0af840b333217a87e5b9d94df
4
- data.tar.gz: dac179b4c433590c7b20c6062361e827de39c62aae2c6aae61304b9e9ffaca04
3
+ metadata.gz: e2fbfad4eca9d8be81cde9c22367e6cf29020baad9411acfffe4abe2f51d99fe
4
+ data.tar.gz: 39cacb9b310c315c5e0fff63a88903e69b4a618b324f0bcabfe78f4b70530a01
5
5
  SHA512:
6
- metadata.gz: 2e7d6031d0ecab21c7b7b80e265b4397155f4ac0ae9aa40e70cc800a9ad3631889a303418ac17b9d7f21076682c045ed750d1b1c34b8d801ff4ad59d33cfefee
7
- data.tar.gz: 239f8aba0becd85787d49ed1b6a4102e94a3e5b77d375591cddc5df98bd5bd307c2828eb900cc8d056ba71a4f57d4b193aa924330d2bf8c3b6af3c37f6017cef
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Activerecord
4
4
  module Cte
5
- VERSION = "0.1.1"
5
+ VERSION = "0.1.3"
6
6
  end
7
7
  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.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: 2020-04-06 00:00:00.000000000 Z
11
+ date: 2021-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord