airrecord 1.0.1 → 1.0.2

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
- SHA256:
3
- metadata.gz: 534c1f26e6248221487da3863fd700cb426b937cf26ece866a56c453f2bb70e9
4
- data.tar.gz: dcfd2eaae567f63143fb2e2a4148faad1fd142bad54a16e3c9791b225c350b08
2
+ SHA1:
3
+ metadata.gz: 96fc25d42d967d7a810f837ed83689650d4bcde7
4
+ data.tar.gz: '058cb52c3f0a3a72ab093efb5052d90388dd9fb9'
5
5
  SHA512:
6
- metadata.gz: ef4e7f2a364a4a489c6eed6f7750855e118afcab19f1511bda87217a252b7d1f0a8bce1669aaf3ced875c4ea76c0629052ea2fbfec2dcf3e10e0320e789ff9d0
7
- data.tar.gz: 2845f143db4a202f050c5382a4b2596296ef725a40004ddc779e35e74d78ba025914c3294411043ddfcbd8351d045368c0dcfdc1bfc87c87dcefe7d6d76bc7ed
6
+ metadata.gz: 5a615028f21e1d195f9b7e72334e02833a245e27df39a97ddecdb7ead4fed4de0aa0155d2993e3f1e90059037b18c3fe8c60015f02f7e8176e509259e697cbb8
7
+ data.tar.gz: f80dc3f0d28ddc8e2b4bf97b228f7d05cadfea62353aea9ab07912b7197c87a749bdfd696752d5ed2667b836e37bba04458fd17ac9fded709f213edadb02fb0a
data/CHANGELOG.md CHANGED
@@ -1,4 +1,15 @@
1
+ # 1.0.2
2
+
3
+ * When a `has_one` or `belongs_to` association is empty, return `nil` instead of
4
+ a blank record (#51)
5
+
6
+ * When a `has_many` association is empty, do not make a network call to the
7
+ associated table
8
+
9
+ * Relax dependency on `net-http-persistent` to allow latest (#57)
10
+
1
11
  # 1.0.1
12
+
2
13
  * Support JRuby 9.0 and CRuby 2.2 (#47)
3
14
  * Fix $stderr warnings in CRurby > 2.3 (#46)
4
15
 
data/airrecord.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.required_ruby_version = '>= 2.2'
22
22
 
23
23
  spec.add_dependency 'faraday', '~> 0.10'
24
- spec.add_dependency "net-http-persistent", '~> 2.9'
24
+ spec.add_dependency "net-http-persistent", '>= 2.9'
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.12"
27
27
  spec.add_development_dependency "rake", "~> 10.0"
@@ -19,7 +19,9 @@ module Airrecord
19
19
  # sort associations in opposite directions. We want to match the UI.
20
20
  ids = (self[options.fetch(:column)] || []).reverse
21
21
  table = Kernel.const_get(options.fetch(:class))
22
- options[:single] ? table.find(ids.first) : table.find_many(ids)
22
+ return table.find_many(ids) unless options[:single]
23
+
24
+ (id = ids.first) ? table.find(id) : nil
23
25
  end
24
26
 
25
27
  define_method("#{method_name}=".to_sym) do |value|
@@ -45,6 +47,8 @@ module Airrecord
45
47
  end
46
48
 
47
49
  def find_many(ids)
50
+ return [] if ids.empty?
51
+
48
52
  or_args = ids.map { |id| "RECORD_ID() = '#{id}'"}.join(',')
49
53
  formula = "OR(#{or_args})"
50
54
  records(filter: formula).sort_by { |record| or_args.index(record.id) }
@@ -1,3 +1,3 @@
1
1
  module Airrecord
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airrecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Eskildsen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-28 00:00:00.000000000 Z
11
+ date: 2019-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -28,14 +28,14 @@ dependencies:
28
28
  name: net-http-persistent
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '2.9'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.9'
41
41
  - !ruby/object:Gem::Dependency
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  version: '0'
138
138
  requirements: []
139
139
  rubyforge_project:
140
- rubygems_version: 2.7.6
140
+ rubygems_version: 2.5.2.3
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: Airtable client