toast 1.1.7 → 1.1.8
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/lib/toast/plural_assoc_request.rb +8 -3
- data/lib/toast/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: 0f41632506c8ae81b4268d1f84d714da161b61cf13591b7d197fa17b788e2a7b
|
4
|
+
data.tar.gz: 4419a0ddf47f807671ea9f91a741f054850b4e23144ed1ffdc930d06a4d3a1c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4276af92bbb3970260b3f5037a541364c1e91fd2e1f570da0da09d8fab39a08066d7e4a19de91e38d4868c92ff6fdc487b966c567525207d3d383f47647fb70
|
7
|
+
data.tar.gz: 17e9fb003dec88439635f434b04e7ca782f48176e8cbdc86b840d791de42f32ce8d3211bfa81425fdb02e2dc4b4547e65f750e7bc57c5528791de71d197e7233
|
@@ -51,15 +51,15 @@ class Toast::PluralAssocRequest
|
|
51
51
|
end
|
52
52
|
|
53
53
|
source = @base_config.model_class.find(@id) # may raise ActiveRecord::RecordNotFound
|
54
|
+
|
55
|
+
call_allow(@config.via_get.permissions, @auth, source, @uri_params) # may raise NotAllowed, AllowError
|
54
56
|
relation = call_handler(@config.via_get.handler, source, @uri_params) # may raise HandlerError
|
55
57
|
|
56
58
|
unless relation.is_a? ActiveRecord::Relation and relation.model.name == @config.target_model_class.name
|
57
59
|
return response :internal_server_error,
|
58
60
|
msg: "plural association handler returned `#{relation.class}', expected `ActiveRecord::Relation' (#{@config.target_model_class})"
|
59
61
|
end
|
60
|
-
|
61
|
-
call_allow(@config.via_get.permissions, @auth, source, @uri_params) # may raise NotAllowed, AllowError
|
62
|
-
|
62
|
+
|
63
63
|
result = relation.limit(window).offset(range_start)
|
64
64
|
|
65
65
|
# count = relation.count doesn't always work
|
@@ -68,6 +68,11 @@ class Toast::PluralAssocRequest
|
|
68
68
|
# also remove any ORDER clauses
|
69
69
|
|
70
70
|
count = relation.unscope(:select).select(:id).count
|
71
|
+
if(count.is_a? Hash)
|
72
|
+
# can happen with 'GROUP BY'
|
73
|
+
count = count.length
|
74
|
+
end
|
75
|
+
|
71
76
|
headers = {"Content-Type" => @config.media_type}
|
72
77
|
|
73
78
|
if count > 0
|
data/lib/toast/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- robokopp (Robert Annies)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
|
-
rubygems_version: 3.2.
|
97
|
+
rubygems_version: 3.2.33
|
98
98
|
signing_key:
|
99
99
|
specification_version: 4
|
100
100
|
summary: Toast exposes ActiveRecord models as a web service (REST API).
|