toast 1.1.7 → 1.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/toast/plural_assoc_request.rb +8 -3
- data/lib/toast/version.rb +1 -1
- data/lib/toast.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: 48d3212cde108f0035fcbf188e4c2568767c81a15c794f8d509492947596d22f
|
4
|
+
data.tar.gz: 6744e077984a693447072a61ac58ae9e13c40c83fa902412bd9286ca0d014b7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 523cfef52ef253eca35d9e4aa0cf8054d1b8f0e69bbea5630ffec78f4e5dfb8ddb1e080cf23895bf17639c40a4d97ffe2f522495fc69a06e1021ddf383b7266b
|
7
|
+
data.tar.gz: 2852b2531c3ddfc016d42f02e6fe5ec870ed4d84b170838bb7ac821c220974b04a9618dcfe604cab1b0584754dc65937f5b312656660538a84beb50fcf89ad50
|
@@ -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
data/lib/toast.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.9
|
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-10-27 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).
|