occams-record 0.18.0 → 0.19.0

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: d063911588247d30e32783e988604e78179830ec5c8ae9e056836f6c2f5385ca
4
- data.tar.gz: 32c4b023d7a4cdbb3f239fafa314d42e15f10548e752b468b3f02741a7532839
3
+ metadata.gz: 4835c655a7c4f9e68b567bc5727d9d99c13e638bb457a7615bb5ee598ae0499b
4
+ data.tar.gz: 7a3ec8be97cbcb06f1b74bfd5e55e163b2fd6bacd163764551581ccdee92f16f
5
5
  SHA512:
6
- metadata.gz: d47e0a4b3fcf1eb12fc58c4a0b11a6295449999299c4f2446fbfeac35b0434476006df14a804399b3f5c0175f7a9910b0b6426f558f3a8ea74972b4bc91030dc
7
- data.tar.gz: 73fe55bff9056c03b1f0b45c9f5a60fd2e97df2e31eeafc7d90323435f1246e112fca06797e650432314a476dff371acc2a6aff55945a60694e80e2c7856d1bd
6
+ metadata.gz: b38f0a2f9fb329ee1ea9d0fe098a9dc8854744effef9f6699209b5375e2cd1f68b2dcb557821c074653396ad4607db75f38c054b2b72b3736714a13b3ea49050
7
+ data.tar.gz: 5c9869505a2bf795156252e81871166fa0a5818798cae9ad51d6a1099938fd3a3e00922aabd22259f4073f0f8f68f4d5cb83f27bed58d01bc02a1b793e48ac99
@@ -12,7 +12,7 @@ module OccamsRecord
12
12
  #
13
13
  def query(rows)
14
14
  ids = rows.map { |r| r.send @ref.foreign_key }.compact.uniq
15
- yield base_scope.where(@ref.active_record_primary_key => ids)
15
+ yield base_scope.where(@ref.active_record_primary_key => ids) if ids.any?
16
16
  end
17
17
 
18
18
  #
@@ -12,7 +12,7 @@ module OccamsRecord
12
12
  #
13
13
  def query(rows)
14
14
  assoc_ids = join_rows(rows).map { |row| row[1] }.compact.uniq
15
- yield base_scope.where(@ref.association_primary_key => assoc_ids)
15
+ yield base_scope.where(@ref.association_primary_key => assoc_ids) if assoc_ids.any?
16
16
  end
17
17
 
18
18
  #
@@ -15,7 +15,7 @@ module OccamsRecord
15
15
  ids = rows.map { |r| r.send @ref.active_record_primary_key }.compact.uniq
16
16
  q = base_scope.where(@ref.foreign_key => ids)
17
17
  q.where!(@ref.type => rows[0].class&.model_name) if @ref.options[:as]
18
- yield q
18
+ yield q if ids.any?
19
19
  end
20
20
 
21
21
  #
@@ -47,7 +47,7 @@ module OccamsRecord
47
47
  model = type.constantize
48
48
  ids = rows_of_type.map(&@foreign_key).uniq
49
49
  q = base_scope(model).where(model.primary_key => ids)
50
- yield q
50
+ yield q if ids.any?
51
51
  end
52
52
  end
53
53
 
@@ -3,5 +3,5 @@
3
3
  #
4
4
  module OccamsRecord
5
5
  # Library version
6
- VERSION = '0.18.0'.freeze
6
+ VERSION = '0.19.0'.freeze
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: occams-record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Hollinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-26 00:00:00.000000000 Z
11
+ date: 2018-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord