pretty-api 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/pretty_api/parameters/nested_attributes.rb +3 -3
- data/lib/pretty_api/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3133e955e326cec2857e0c68eb8013c18f370a0ad92d94793e973950690cd143
|
4
|
+
data.tar.gz: 3052057563fbbf602cdebcedc398a09b1b9fb31e68678c1f97e055084c78d2ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
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
|
data/lib/pretty_api/version.rb
CHANGED
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.
|
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-
|
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.
|
73
|
+
rubygems_version: 3.5.11
|
74
74
|
signing_key:
|
75
75
|
specification_version: 4
|
76
76
|
summary: Pretty API for Rails
|