jsonapi_actions 0.4.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +137 -96
- data/jsonapi_actions.gemspec +1 -1
- data/lib/jsonapi_actions/version.rb +1 -1
- data/lib/jsonapi_actions.rb +113 -111
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94c6363f31fa607be5d701095e0e35de2fa629217790e73c9a936690d5d6ad24
|
4
|
+
data.tar.gz: c2bf209aba2c38641420a53ab8ed65a313cebfda1aa2c5f1928ee813c7ba2a45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46a6ff5a7e0b42f7a4dc956f990a1f6c4220b9b8c7f51e3fecece495f2004b10cfaddaec05b677f832fa38b52e8a7a35b18750c454c5027e58419f4d105c75f8
|
7
|
+
data.tar.gz: 2e6a382eb9b4b7f28436fd5524045b315d2d0b48cf192d994773dd1d441d9024d92a3ab2589fb66041e4ba702a32c23936f5f40f0bc4992e96d6dc30906cda99
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.7.
|
1
|
+
ruby-2.7.4
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [0.5.0] - 2023-02-22
|
8
|
+
### Added
|
9
|
+
- Added `serializer_params` method to more easily allow for custom serializer params.
|
10
|
+
|
7
11
|
## [0.2.2] - 2020-05-18
|
8
12
|
### Fixed
|
9
13
|
- JsonapiActions#json_response uses `defined?` to check for serializer library
|
data/Gemfile.lock
CHANGED
@@ -1,87 +1,105 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jsonapi_actions (0.
|
4
|
+
jsonapi_actions (0.6.0)
|
5
5
|
kaminari (>= 1.0, < 2.0)
|
6
|
-
rails (>= 4.0, <
|
6
|
+
rails (>= 4.0, < 8)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (7.
|
12
|
-
actionpack (= 7.
|
13
|
-
activesupport (= 7.
|
11
|
+
actioncable (7.1.3.4)
|
12
|
+
actionpack (= 7.1.3.4)
|
13
|
+
activesupport (= 7.1.3.4)
|
14
14
|
nio4r (~> 2.0)
|
15
15
|
websocket-driver (>= 0.6.1)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
zeitwerk (~> 2.6)
|
17
|
+
actionmailbox (7.1.3.4)
|
18
|
+
actionpack (= 7.1.3.4)
|
19
|
+
activejob (= 7.1.3.4)
|
20
|
+
activerecord (= 7.1.3.4)
|
21
|
+
activestorage (= 7.1.3.4)
|
22
|
+
activesupport (= 7.1.3.4)
|
22
23
|
mail (>= 2.7.1)
|
23
24
|
net-imap
|
24
25
|
net-pop
|
25
26
|
net-smtp
|
26
|
-
actionmailer (7.
|
27
|
-
actionpack (= 7.
|
28
|
-
actionview (= 7.
|
29
|
-
activejob (= 7.
|
30
|
-
activesupport (= 7.
|
27
|
+
actionmailer (7.1.3.4)
|
28
|
+
actionpack (= 7.1.3.4)
|
29
|
+
actionview (= 7.1.3.4)
|
30
|
+
activejob (= 7.1.3.4)
|
31
|
+
activesupport (= 7.1.3.4)
|
31
32
|
mail (~> 2.5, >= 2.5.4)
|
32
33
|
net-imap
|
33
34
|
net-pop
|
34
35
|
net-smtp
|
35
|
-
rails-dom-testing (~> 2.
|
36
|
-
actionpack (7.
|
37
|
-
actionview (= 7.
|
38
|
-
activesupport (= 7.
|
39
|
-
|
36
|
+
rails-dom-testing (~> 2.2)
|
37
|
+
actionpack (7.1.3.4)
|
38
|
+
actionview (= 7.1.3.4)
|
39
|
+
activesupport (= 7.1.3.4)
|
40
|
+
nokogiri (>= 1.8.5)
|
41
|
+
racc
|
42
|
+
rack (>= 2.2.4)
|
43
|
+
rack-session (>= 1.0.1)
|
40
44
|
rack-test (>= 0.6.3)
|
41
|
-
rails-dom-testing (~> 2.
|
42
|
-
rails-html-sanitizer (~> 1.
|
43
|
-
actiontext (7.
|
44
|
-
actionpack (= 7.
|
45
|
-
activerecord (= 7.
|
46
|
-
activestorage (= 7.
|
47
|
-
activesupport (= 7.
|
45
|
+
rails-dom-testing (~> 2.2)
|
46
|
+
rails-html-sanitizer (~> 1.6)
|
47
|
+
actiontext (7.1.3.4)
|
48
|
+
actionpack (= 7.1.3.4)
|
49
|
+
activerecord (= 7.1.3.4)
|
50
|
+
activestorage (= 7.1.3.4)
|
51
|
+
activesupport (= 7.1.3.4)
|
48
52
|
globalid (>= 0.6.0)
|
49
53
|
nokogiri (>= 1.8.5)
|
50
|
-
actionview (7.
|
51
|
-
activesupport (= 7.
|
54
|
+
actionview (7.1.3.4)
|
55
|
+
activesupport (= 7.1.3.4)
|
52
56
|
builder (~> 3.1)
|
53
|
-
erubi (~> 1.
|
54
|
-
rails-dom-testing (~> 2.
|
55
|
-
rails-html-sanitizer (~> 1.
|
56
|
-
activejob (7.
|
57
|
-
activesupport (= 7.
|
57
|
+
erubi (~> 1.11)
|
58
|
+
rails-dom-testing (~> 2.2)
|
59
|
+
rails-html-sanitizer (~> 1.6)
|
60
|
+
activejob (7.1.3.4)
|
61
|
+
activesupport (= 7.1.3.4)
|
58
62
|
globalid (>= 0.3.6)
|
59
|
-
activemodel (7.
|
60
|
-
activesupport (= 7.
|
61
|
-
activerecord (7.
|
62
|
-
activemodel (= 7.
|
63
|
-
activesupport (= 7.
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
63
|
+
activemodel (7.1.3.4)
|
64
|
+
activesupport (= 7.1.3.4)
|
65
|
+
activerecord (7.1.3.4)
|
66
|
+
activemodel (= 7.1.3.4)
|
67
|
+
activesupport (= 7.1.3.4)
|
68
|
+
timeout (>= 0.4.0)
|
69
|
+
activestorage (7.1.3.4)
|
70
|
+
actionpack (= 7.1.3.4)
|
71
|
+
activejob (= 7.1.3.4)
|
72
|
+
activerecord (= 7.1.3.4)
|
73
|
+
activesupport (= 7.1.3.4)
|
69
74
|
marcel (~> 1.0)
|
70
|
-
|
71
|
-
|
75
|
+
activesupport (7.1.3.4)
|
76
|
+
base64
|
77
|
+
bigdecimal
|
72
78
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
79
|
+
connection_pool (>= 2.2.5)
|
80
|
+
drb
|
73
81
|
i18n (>= 1.6, < 2)
|
74
82
|
minitest (>= 5.1)
|
83
|
+
mutex_m
|
75
84
|
tzinfo (~> 2.0)
|
76
|
-
|
77
|
-
|
85
|
+
base64 (0.2.0)
|
86
|
+
bigdecimal (3.1.8)
|
87
|
+
builder (3.3.0)
|
88
|
+
concurrent-ruby (1.3.3)
|
89
|
+
connection_pool (2.4.1)
|
78
90
|
crass (1.0.6)
|
91
|
+
date (3.3.4)
|
79
92
|
diff-lcs (1.3)
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
93
|
+
drb (2.2.1)
|
94
|
+
erubi (1.12.0)
|
95
|
+
globalid (1.2.1)
|
96
|
+
activesupport (>= 6.1)
|
97
|
+
i18n (1.14.5)
|
84
98
|
concurrent-ruby (~> 1.0)
|
99
|
+
io-console (0.7.2)
|
100
|
+
irb (1.13.1)
|
101
|
+
rdoc (>= 4.0.0)
|
102
|
+
reline (>= 0.4.2)
|
85
103
|
kaminari (1.2.2)
|
86
104
|
activesupport (>= 4.1.0)
|
87
105
|
kaminari-actionview (= 1.2.2)
|
@@ -94,57 +112,77 @@ GEM
|
|
94
112
|
activerecord
|
95
113
|
kaminari-core (= 1.2.2)
|
96
114
|
kaminari-core (1.2.2)
|
97
|
-
loofah (2.
|
115
|
+
loofah (2.22.0)
|
98
116
|
crass (~> 1.0.2)
|
99
|
-
nokogiri (>= 1.
|
100
|
-
mail (2.
|
117
|
+
nokogiri (>= 1.12.0)
|
118
|
+
mail (2.8.1)
|
101
119
|
mini_mime (>= 0.1.1)
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
120
|
+
net-imap
|
121
|
+
net-pop
|
122
|
+
net-smtp
|
123
|
+
marcel (1.0.4)
|
124
|
+
mini_mime (1.1.5)
|
125
|
+
mini_portile2 (2.8.7)
|
126
|
+
minitest (5.23.1)
|
127
|
+
mutex_m (0.2.0)
|
128
|
+
net-imap (0.4.12)
|
129
|
+
date
|
107
130
|
net-protocol
|
108
131
|
net-pop (0.1.2)
|
109
132
|
net-protocol
|
110
|
-
net-protocol (0.
|
133
|
+
net-protocol (0.2.2)
|
111
134
|
timeout
|
112
|
-
net-smtp (0.
|
135
|
+
net-smtp (0.5.0)
|
113
136
|
net-protocol
|
114
|
-
nio4r (2.
|
115
|
-
nokogiri (1.
|
137
|
+
nio4r (2.7.3)
|
138
|
+
nokogiri (1.15.6)
|
139
|
+
mini_portile2 (~> 2.8.2)
|
116
140
|
racc (~> 1.4)
|
117
|
-
|
118
|
-
|
119
|
-
|
141
|
+
psych (5.1.2)
|
142
|
+
stringio
|
143
|
+
racc (1.8.0)
|
144
|
+
rack (3.1.0)
|
145
|
+
rack-session (2.0.0)
|
146
|
+
rack (>= 3.0.0)
|
147
|
+
rack-test (2.1.0)
|
120
148
|
rack (>= 1.3)
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
149
|
+
rackup (2.1.0)
|
150
|
+
rack (>= 3)
|
151
|
+
webrick (~> 1.8)
|
152
|
+
rails (7.1.3.4)
|
153
|
+
actioncable (= 7.1.3.4)
|
154
|
+
actionmailbox (= 7.1.3.4)
|
155
|
+
actionmailer (= 7.1.3.4)
|
156
|
+
actionpack (= 7.1.3.4)
|
157
|
+
actiontext (= 7.1.3.4)
|
158
|
+
actionview (= 7.1.3.4)
|
159
|
+
activejob (= 7.1.3.4)
|
160
|
+
activemodel (= 7.1.3.4)
|
161
|
+
activerecord (= 7.1.3.4)
|
162
|
+
activestorage (= 7.1.3.4)
|
163
|
+
activesupport (= 7.1.3.4)
|
133
164
|
bundler (>= 1.15.0)
|
134
|
-
railties (= 7.
|
135
|
-
rails-dom-testing (2.0
|
136
|
-
activesupport (>=
|
165
|
+
railties (= 7.1.3.4)
|
166
|
+
rails-dom-testing (2.2.0)
|
167
|
+
activesupport (>= 5.0.0)
|
168
|
+
minitest
|
137
169
|
nokogiri (>= 1.6)
|
138
|
-
rails-html-sanitizer (1.
|
139
|
-
loofah (~> 2.
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
170
|
+
rails-html-sanitizer (1.6.0)
|
171
|
+
loofah (~> 2.21)
|
172
|
+
nokogiri (~> 1.14)
|
173
|
+
railties (7.1.3.4)
|
174
|
+
actionpack (= 7.1.3.4)
|
175
|
+
activesupport (= 7.1.3.4)
|
176
|
+
irb
|
177
|
+
rackup (>= 1.0.0)
|
144
178
|
rake (>= 12.2)
|
145
|
-
thor (~> 1.0)
|
146
|
-
zeitwerk (~> 2.
|
179
|
+
thor (~> 1.0, >= 1.2.2)
|
180
|
+
zeitwerk (~> 2.6)
|
147
181
|
rake (13.0.1)
|
182
|
+
rdoc (6.7.0)
|
183
|
+
psych (>= 4.0.0)
|
184
|
+
reline (0.5.8)
|
185
|
+
io-console (~> 0.5)
|
148
186
|
rspec (3.8.0)
|
149
187
|
rspec-core (~> 3.8.0)
|
150
188
|
rspec-expectations (~> 3.8.0)
|
@@ -158,16 +196,19 @@ GEM
|
|
158
196
|
diff-lcs (>= 1.2.0, < 2.0)
|
159
197
|
rspec-support (~> 3.8.0)
|
160
198
|
rspec-support (3.8.0)
|
161
|
-
|
162
|
-
|
163
|
-
|
199
|
+
stringio (3.1.0)
|
200
|
+
thor (1.3.1)
|
201
|
+
timeout (0.4.1)
|
202
|
+
tzinfo (2.0.6)
|
164
203
|
concurrent-ruby (~> 1.0)
|
165
|
-
|
204
|
+
webrick (1.8.1)
|
205
|
+
websocket-driver (0.7.6)
|
166
206
|
websocket-extensions (>= 0.1.0)
|
167
207
|
websocket-extensions (0.1.5)
|
168
|
-
zeitwerk (2.6.
|
208
|
+
zeitwerk (2.6.15)
|
169
209
|
|
170
210
|
PLATFORMS
|
211
|
+
arm64-darwin-22
|
171
212
|
ruby
|
172
213
|
x86_64-darwin-20
|
173
214
|
|
data/jsonapi_actions.gemspec
CHANGED
@@ -27,6 +27,6 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "rake", "~> 13.0"
|
28
28
|
spec.add_development_dependency "rspec", "~> 3.0"
|
29
29
|
|
30
|
-
spec.add_dependency 'rails', '>= 4.0', '<
|
30
|
+
spec.add_dependency 'rails', '>= 4.0', '< 8'
|
31
31
|
spec.add_dependency 'kaminari', '>= 1.0', '< 2.0'
|
32
32
|
end
|
data/lib/jsonapi_actions.rb
CHANGED
@@ -74,146 +74,148 @@ module JsonapiActions
|
|
74
74
|
|
75
75
|
private
|
76
76
|
|
77
|
-
|
78
|
-
|
79
|
-
|
77
|
+
def metadata
|
78
|
+
{}
|
79
|
+
end
|
80
80
|
|
81
|
-
|
82
|
-
|
81
|
+
def parent_scope(records)
|
82
|
+
return records if self.class.parent_associations.blank?
|
83
83
|
|
84
|
-
|
85
|
-
|
84
|
+
self.class.parent_associations.each do |parent|
|
85
|
+
next if params[parent[:param]].blank?
|
86
86
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
87
|
+
records = records.joins(parent[:association]) unless parent[:association].blank?
|
88
|
+
records = if parent[:table]
|
89
|
+
records.where(parent[:table] => { parent[:attribute] => params[parent[:param]] })
|
90
|
+
else
|
91
|
+
records.where(parent[:attribute] => params[parent[:param]])
|
92
|
+
end
|
93
|
+
end
|
94
94
|
|
95
|
-
|
96
|
-
|
95
|
+
records
|
96
|
+
end
|
97
97
|
|
98
|
-
|
99
|
-
|
100
|
-
|
98
|
+
def filter(records)
|
99
|
+
records
|
100
|
+
end
|
101
101
|
|
102
|
-
|
103
|
-
|
104
|
-
|
102
|
+
def sort(records)
|
103
|
+
return records if params[:sort].blank?
|
104
|
+
order = {}
|
105
105
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
106
|
+
params[:sort].split(',').each do |sort|
|
107
|
+
if sort[0] == '-'
|
108
|
+
order[sort[1..-1]] = :desc
|
109
|
+
else
|
110
|
+
order[sort] = :asc
|
111
|
+
end
|
111
112
|
end
|
113
|
+
|
114
|
+
return records.order(order)
|
112
115
|
end
|
113
116
|
|
114
|
-
|
115
|
-
|
117
|
+
def paginate(records)
|
118
|
+
records.page(page[:number]).per(page[:size])
|
119
|
+
end
|
116
120
|
|
117
|
-
|
118
|
-
|
119
|
-
|
121
|
+
def page
|
122
|
+
@page ||= begin
|
123
|
+
page = {}
|
124
|
+
page[:number] = (params.dig(:page, :number) || 1).to_i
|
125
|
+
page[:size] = [[(params.dig(:page, :size) || 20).to_i, 1000].min, 1].max
|
126
|
+
page
|
127
|
+
end
|
128
|
+
end
|
120
129
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
page[:size] = [[(params.dig(:page, :size) || 20).to_i, 1000].min, 1].max
|
126
|
-
page
|
127
|
-
end
|
128
|
-
end
|
130
|
+
def set_record
|
131
|
+
@record = model.find(params[:id])
|
132
|
+
authorize(@record)
|
133
|
+
end
|
129
134
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
end
|
135
|
+
def id_param
|
136
|
+
params.require(:data).permit(policy(@record).permitted_attributes)[:id]
|
137
|
+
end
|
134
138
|
|
135
|
-
|
136
|
-
|
137
|
-
|
139
|
+
def record_params
|
140
|
+
params.require(:data).require(:attributes).permit(policy(@record).permitted_attributes)
|
141
|
+
end
|
138
142
|
|
139
|
-
|
140
|
-
|
141
|
-
|
143
|
+
def include_param
|
144
|
+
if %w[* **].include? params[:include]
|
145
|
+
inclusion_map
|
146
|
+
else
|
147
|
+
params[:include].to_s.split(',').reject(&:blank?).map(&:to_sym)
|
148
|
+
end
|
149
|
+
end
|
142
150
|
|
143
|
-
|
144
|
-
|
145
|
-
inclusion_map
|
146
|
-
else
|
147
|
-
params[:include].to_s.split(',').reject(&:blank?).map(&:to_sym)
|
151
|
+
def inclusion_map
|
152
|
+
InclusionMapper.new(serializer, include: params[:include]).map
|
148
153
|
end
|
149
|
-
end
|
150
154
|
|
151
|
-
|
152
|
-
|
153
|
-
|
155
|
+
def unprocessable_entity(record)
|
156
|
+
Rails.logger.debug(record.errors.messages)
|
157
|
+
{ json: record.errors.messages, status: :unprocessable_entity }
|
158
|
+
end
|
154
159
|
|
155
|
-
|
156
|
-
|
157
|
-
{ json: record.errors.messages, status: :unprocessable_entity }
|
158
|
-
end
|
160
|
+
def pagination_meta(collection)
|
161
|
+
return {} if collection.nil?
|
159
162
|
|
160
|
-
|
161
|
-
|
163
|
+
{
|
164
|
+
current_page: collection.current_page,
|
165
|
+
next_page: collection.next_page,
|
166
|
+
prev_page: collection.prev_page,
|
167
|
+
total_pages: collection.total_pages,
|
168
|
+
total_count: collection.total_count
|
169
|
+
}
|
170
|
+
end
|
162
171
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
prev_page: collection.prev_page,
|
167
|
-
total_pages: collection.total_pages,
|
168
|
-
total_count: collection.total_count
|
169
|
-
}
|
170
|
-
end
|
172
|
+
def model
|
173
|
+
self.class.model || self.class.model_name.constantize
|
174
|
+
end
|
171
175
|
|
172
|
-
|
173
|
-
|
174
|
-
|
176
|
+
def json_response(data, options = {})
|
177
|
+
if defined?(JSONAPI::Serializer) || defined?(FastJsonapi)
|
178
|
+
{
|
179
|
+
json: serializer(data).new(data, options.deep_merge(
|
180
|
+
include: include_param,
|
181
|
+
meta: metadata,
|
182
|
+
params: serializer_params)
|
183
|
+
)
|
184
|
+
}
|
175
185
|
|
176
|
-
|
177
|
-
|
178
|
-
{
|
179
|
-
json: serializer(data).new(data, options.deep_merge(
|
180
|
-
include: include_param,
|
181
|
-
meta: metadata,
|
182
|
-
params: {
|
183
|
-
current_user: try(:current_user)
|
184
|
-
})
|
185
|
-
)
|
186
|
-
}
|
186
|
+
elsif defined?(ActiveModel::Serializer)
|
187
|
+
{ json: data }.merge(meta: metadata, include: include_param).merge(options)
|
187
188
|
|
188
|
-
|
189
|
-
|
189
|
+
else
|
190
|
+
{ json: { data: data }.merge(options) }
|
191
|
+
end
|
192
|
+
end
|
190
193
|
|
191
|
-
|
192
|
-
|
194
|
+
def serializer(data = nil)
|
195
|
+
serializer_classes = [
|
196
|
+
self.class.serializer,
|
197
|
+
data.try(:serializer_class),
|
198
|
+
"#{data.class.name}Serializer".safe_constantize,
|
199
|
+
data.try(:first).try(:serializer_class),
|
200
|
+
"#{data.try(:first).class.name}Serializer".safe_constantize
|
201
|
+
].compact
|
202
|
+
|
203
|
+
if serializer_classes.any?
|
204
|
+
serializer_classes.first
|
205
|
+
else
|
206
|
+
"#{model.name}Serializer".safe_constantize
|
207
|
+
end
|
208
|
+
rescue NoMethodError, NameError
|
209
|
+
raise 'Unknown serializer'
|
193
210
|
end
|
194
|
-
end
|
195
211
|
|
196
|
-
|
197
|
-
|
198
|
-
self.class.serializer,
|
199
|
-
data.try(:serializer_class),
|
200
|
-
"#{data.class.name}Serializer".safe_constantize,
|
201
|
-
data.try(:first).try(:serializer_class),
|
202
|
-
"#{data.try(:first).class.name}Serializer".safe_constantize
|
203
|
-
].compact
|
204
|
-
|
205
|
-
if serializer_classes.any?
|
206
|
-
serializer_classes.first
|
207
|
-
else
|
208
|
-
"#{model.name}Serializer".safe_constantize
|
212
|
+
def serializer_params
|
213
|
+
{ current_user: try(:current_user) }
|
209
214
|
end
|
210
|
-
rescue NoMethodError, NameError
|
211
|
-
raise 'Unknown serializer'
|
212
|
-
end
|
213
215
|
|
214
|
-
|
215
|
-
|
216
|
-
|
216
|
+
def eager_load(records)
|
217
|
+
records
|
218
|
+
end
|
217
219
|
end
|
218
220
|
|
219
221
|
module ClassMethods
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi_actions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Pheasey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -61,7 +61,7 @@ dependencies:
|
|
61
61
|
version: '4.0'
|
62
62
|
- - "<"
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: '
|
64
|
+
version: '8'
|
65
65
|
type: :runtime
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -71,7 +71,7 @@ dependencies:
|
|
71
71
|
version: '4.0'
|
72
72
|
- - "<"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '8'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: kaminari
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
|
-
rubygems_version: 3.1.
|
142
|
+
rubygems_version: 3.1.6
|
143
143
|
signing_key:
|
144
144
|
specification_version: 4
|
145
145
|
summary: Rails JSON:API Controller Actions
|