pretty-api 0.4.0 → 0.4.1

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: 9668f43a29b655b7f053e2e225d8d5fd6cc7e40cf51f07d52604d9032056ccf3
4
- data.tar.gz: 587fce31fb41a7c225dea094650750cf91f197f94f32c45d912e8bd730cfb825
3
+ metadata.gz: 3133e955e326cec2857e0c68eb8013c18f370a0ad92d94793e973950690cd143
4
+ data.tar.gz: 3052057563fbbf602cdebcedc398a09b1b9fb31e68678c1f97e055084c78d2ad
5
5
  SHA512:
6
- metadata.gz: 1ee8e896e7bb56156361b8e2f3ccfc1fb85409ffd37b447fcf325ebc80216f80dcaf75f5aede2c4eec4c739e924d034e07aa63833126ea5e938763b1d57b5dbe
7
- data.tar.gz: eb77378853a03d88cfa769bde7be327cbc4bc7acd326f32b32ce06b01d0c025f09ae454aa934e9b59d2e29a823bcf3fb1598c16fded819c27633a8069e929b4e
6
+ metadata.gz: 5eeb04d0536d7757ebc0c4d95bd5e6fe937d39fc6aadbd6637feee8c0b0e154ae6a0d8b3009f6f410fbc763ec4dae2535551724b3ec33047a015907540c900d7
7
+ data.tar.gz: ba54bd9943b27a2731518a1f6ec1201b645b8331c5eb099f2dcc6ba467561a2116d2c3c011eb2848ea9888be13e264faf113c2954f5b32478c890961baa2d832
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.1] - 2024-06-04
4
+
5
+ - Fix `undefined method `each' for nil` when PrettyAPI is used on record that doesn't have associations
6
+
3
7
  ## [0.4.0] - 2024-06-04
4
8
 
5
9
  - Add support for www-form-urlencoded / multipart format: Fix "No implicit conversion of String into Integer"
@@ -6,6 +6,8 @@ module PrettyApi
6
6
  end
7
7
 
8
8
  def parse(record, params)
9
+ return params if nested_tree[record.class].blank?
10
+
9
11
  parse_nested_attributes(record, params, nested_tree[record.class])
10
12
  end
11
13
 
@@ -42,9 +44,7 @@ module PrettyApi
42
44
 
43
45
  (params[assoc_key] || []).each do |p|
44
46
  assoc_primary_key = record.try(:class).try(:primary_key)
45
- assoc = record.try(assoc_key).try(:detect) do |r|
46
- r.try(assoc_primary_key) == p[assoc_primary_key]
47
- end
47
+ assoc = record.try(assoc_key).try(:detect) { |r| r.try(assoc_primary_key) == p[assoc_primary_key] }
48
48
  parse_nested_attributes(assoc, p, nested_tree[assoc_info[:model]])
49
49
  end
50
50
  end
@@ -1,3 +1,3 @@
1
1
  module PrettyApi
2
- VERSION = "0.4.0".freeze
2
+ VERSION = "0.4.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pretty-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James St-Pierre
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-04 00:00:00.000000000 Z
11
+ date: 2024-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  requirements: []
73
- rubygems_version: 3.5.9
73
+ rubygems_version: 3.5.11
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: Pretty API for Rails