restful_resource 2.2.4 → 2.2.5

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
- SHA1:
3
- metadata.gz: 0f794c3108d0607c5a6cd7170ad63ec5b72d158d
4
- data.tar.gz: c254ccdeb95a90451d2648fe2c593fb2fb11e63e
2
+ SHA256:
3
+ metadata.gz: fe060c35468d46b0d26af25f25d4ee1e076dbc93d7002a3d3fd34d724ca7f8ab
4
+ data.tar.gz: 8eaad0324ee6834eee65ac50d190b1502bc6479825a29dbd7351c35b2a5efb6d
5
5
  SHA512:
6
- metadata.gz: e5185c025b8b3820d6a96756b93a3842422459450ea26eebbff02fe9303b4e89a16e9d94a6e8f2cc78df693f7e37b80202bdc9b8fa742db3fc816c7d09eccd8f
7
- data.tar.gz: e0e62ac321625841fd0f911f1f2fa110ccee6242d7221fc78d7b9c349f8cd8d15ebaa2619a42904a0b3c207f37bd49a3581b490f917dc549a45b0e675e6b6c44
6
+ metadata.gz: 628811833dd6340f11595c8bbab15dfd2928857d0f0669533923b48cafa037016aced821665f71868e43668d07abfa79b66a810cd60e0d7caca14fdacbcaf5a9
7
+ data.tar.gz: 9adb954ac975fe831bd416de7f1461511ba4a3e3dd0946c7a6c77131e6ad887e98c370967dee289b74c7242d22e57ce542dbe15c34905427004108533b7720e3
@@ -12,7 +12,9 @@ module RestfulResource
12
12
  nil
13
13
  end
14
14
  klass = RestfulResource::OpenObject if (klass.nil? || !(klass < RestfulResource::OpenObject))
15
- @inner_object.send(nested_resource_type).map { |obj| klass.new(obj) }
15
+ nested_resource = @inner_object.send(nested_resource_type)
16
+ return nil if nested_resource.nil?
17
+ nested_resource.map { |obj| klass.new(obj) }
16
18
  end
17
19
  end
18
20
 
@@ -1,3 +1,3 @@
1
1
  module RestfulResource
2
- VERSION = '2.2.4'
2
+ VERSION = '2.2.5'
3
3
  end
data/spec/fixtures.rb CHANGED
@@ -39,6 +39,7 @@ module ComplicatedModule
39
39
  resource_path "parent"
40
40
  has_many :children
41
41
  has_many :other_things
42
+ has_many :missing
42
43
 
43
44
  def is_parent?
44
45
  true
@@ -27,6 +27,10 @@ describe RestfulResource::Associations do
27
27
  it "should use open object when can't infer class name of association" do
28
28
  expect(@parent.other_things.first.stuff).to eq 'aaa'
29
29
  end
30
+
31
+ it "should return nil for missing associations" do
32
+ expect(@parent.missing).to be_nil
33
+ end
30
34
  end
31
35
 
32
36
  describe "#has_one" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restful_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.4
4
+ version: 2.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Santoro
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-04-04 00:00:00.000000000 Z
12
+ date: 2018-04-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -258,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
258
  version: '0'
259
259
  requirements: []
260
260
  rubyforge_project:
261
- rubygems_version: 2.6.14
261
+ rubygems_version: 2.7.6
262
262
  signing_key:
263
263
  specification_version: 4
264
264
  summary: A simple activerecord inspired rest resource base class implemented using