active_record_api-rest 1.0.51 → 1.0.52
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fcf73e1b11d29e24a9bac84a12dbba47e0509c9ef86db0f4794c97215ff7523c
|
|
4
|
+
data.tar.gz: d92c60b47145da8a642cf81183a90b82595106d7785228fc20f4c99de280c886
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 40fddf11dd14cbe3dc38f1932f9e704a699b3c5dc115c75a8b706817140121354d1a43b4985a571ae6e9f795b9ffdbf5831b3bf919f1d1ab7d1343ac154a33d8
|
|
7
|
+
data.tar.gz: 21725971508a92f5ae337556e462f2d152362fa0fecade3ad7d7766351169e9393f6711598e0bc5746800fe2ae279125622e813a2f1abc91da04602dee76e2cf
|
|
@@ -31,6 +31,10 @@ module ActiveRecordApi
|
|
|
31
31
|
can_read? || can_manage?
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
+
def can_new?
|
|
35
|
+
can_read? || can_manage?
|
|
36
|
+
end
|
|
37
|
+
|
|
34
38
|
def can_create?
|
|
35
39
|
can_manage?
|
|
36
40
|
end
|
|
@@ -55,6 +59,10 @@ module ActiveRecordApi
|
|
|
55
59
|
model_klass.where('1=0')
|
|
56
60
|
end
|
|
57
61
|
|
|
62
|
+
def new
|
|
63
|
+
model_klass.where('1=0')
|
|
64
|
+
end
|
|
65
|
+
|
|
58
66
|
def create
|
|
59
67
|
model_klass.new
|
|
60
68
|
end
|
|
@@ -17,6 +17,11 @@ module ActiveRecordApi
|
|
|
17
17
|
render json: model, serializer: serializer
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
def new
|
|
21
|
+
attributes = params - [:action]
|
|
22
|
+
render json: authorized_models.send(params[:action], attributes), serializer: serializer
|
|
23
|
+
end
|
|
24
|
+
|
|
20
25
|
def create
|
|
21
26
|
if model.save
|
|
22
27
|
render json: model, serializer: serializer
|
|
@@ -92,11 +97,11 @@ module ActiveRecordApi
|
|
|
92
97
|
end
|
|
93
98
|
|
|
94
99
|
def pagination_param_name
|
|
95
|
-
@pagination_param_name ||= :id
|
|
100
|
+
@pagination_param_name ||= params[:pagination_param] || :id
|
|
96
101
|
end
|
|
97
102
|
|
|
98
103
|
def pagination_param_direction
|
|
99
|
-
@pagination_param_direction ||= :asc # from params
|
|
104
|
+
@pagination_param_direction ||= params[:pagination_param_direction] || :asc # from params
|
|
100
105
|
end
|
|
101
106
|
|
|
102
107
|
def pagination_param_value
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_record_api-rest
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.52
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Full Measure Education
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-10-
|
|
11
|
+
date: 2019-10-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|