snfoil-rails 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sn_foil/controller/api.rb +10 -3
- data/lib/sn_foil/rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 552d48b3b6acfe4814b6c058c65ae6b93853c8a8d954447e916b96252439cf7c
|
4
|
+
data.tar.gz: 9fc7c3fcae1f33429ae733ea74ea1eefd0a9be03852b3796ba60cd4169c6659b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18575fcc9acd7102cb6b9d023dda3f911f38864824ea4b02144ac37471c48b271bfea04d62aeb2da644b5c2343f6fdd462a59a0ae184c0e03ffe58ead39ed9b1
|
7
|
+
data.tar.gz: 3393de5fd2ed5bbee912f67c19e3573f1179c95e66d20385df01c70d0d658459c705ef46ed94a17fd6cf9af200006a6eab0c2b5a6a9e2311197a8955b324cdd9
|
@@ -41,7 +41,10 @@ module SnFoil
|
|
41
41
|
def render_change(model, **options)
|
42
42
|
if model.errors.empty?
|
43
43
|
params
|
44
|
-
render json: serializer(**options).new(model,
|
44
|
+
render json: serializer(**options).new(model,
|
45
|
+
**options,
|
46
|
+
params: (options[:controller_params] || options[:params] || {})
|
47
|
+
.merge(current_entity: current_entity)).serializable_hash
|
45
48
|
else
|
46
49
|
render json: model.errors, status: :unprocessable_entity
|
47
50
|
end
|
@@ -58,13 +61,17 @@ module SnFoil
|
|
58
61
|
def render_index(results, **options)
|
59
62
|
render json: serializer(**options).new(paginate(results, **options),
|
60
63
|
**options,
|
61
|
-
params:
|
64
|
+
params: (options[:controller_params] || options[:params] || {})
|
65
|
+
.merge(current_entity: current_entity),
|
62
66
|
meta: meta(results, **options))
|
63
67
|
.serializable_hash
|
64
68
|
end
|
65
69
|
|
66
70
|
def render_show(model, **options)
|
67
|
-
render json: serializer(**options).new(model,
|
71
|
+
render json: serializer(**options).new(model,
|
72
|
+
**options,
|
73
|
+
params: (options[:controller_params] || options[:params] || {})
|
74
|
+
.merge(current_entity: current_entity)).serializable_hash
|
68
75
|
end
|
69
76
|
|
70
77
|
private
|