pastore 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/docs/Params.md +2 -2
- data/lib/pastore/params.rb +1 -1
- data/lib/pastore/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: 9b18cf526ca05274e02fa4bcead59a87e4a82e935c2ce7c08a304981576b03ee
|
4
|
+
data.tar.gz: b4fce59dffa87a983499371623b889d7fde5a19da094cd297426415233fb0775
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40fcf8d950b6b2e4eb4ddce12b94e769f9c3c804762d8df25fc4290294af1007aa12431c124acdc2301d8d657586e3d13a730556bbd9965ab367437304002942
|
7
|
+
data.tar.gz: efe5fd3ae50528be460f8d53b90673e516767a8201056f775b9a89aac1994b4ab54b3096221ad24cc7d4cb1f833f7f8a928393c27fcf8b522e58e0d0beb9fbbd
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.2.1] - 2023-02-16
|
4
|
+
|
5
|
+
- [FIX] Pass validation errors to `on_invalid_params` block, in order to be able to customize the errors returned on invalid params response.
|
6
|
+
|
3
7
|
## [0.2.0] - 2023-02-16
|
4
8
|
|
5
9
|
- [NEW] Implemented the feature which allows to get the current role with `#current_role` method inside controllers actions.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
[![Maintainability](https://api.codeclimate.com/v1/badges/8f203ba7696c063e9cd2/maintainability)](https://codeclimate.com/github/demetra-it/pastore/maintainability)
|
4
4
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/8f203ba7696c063e9cd2/test_coverage)](https://codeclimate.com/github/demetra-it/pastore/test_coverage)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/pastore.svg)](https://badge.fury.io/rb/pastore)
|
6
|
+
|
5
7
|
|
6
8
|
Pastore is a powerful gem for Rails that simplifies the process of validating parameters and controlling access to actions in your controllers.
|
7
9
|
With Pastore, you can easily define validations for your parameters, ensuring that they meet specific requirements before being passed to your controller actions.
|
data/docs/Params.md
CHANGED
@@ -24,8 +24,8 @@ class ApplicationController < ActionController::API
|
|
24
24
|
invalid_params_status :bad_request
|
25
25
|
|
26
26
|
# Here you can customize the response to return on invalid params
|
27
|
-
on_invalid_params do
|
28
|
-
render json: { message: 'Invalid params' }
|
27
|
+
on_invalid_params do |validation_errors|
|
28
|
+
render json: { message: 'Invalid params', errors: validation_errors }
|
29
29
|
end
|
30
30
|
|
31
31
|
# ...
|
data/lib/pastore/params.rb
CHANGED
@@ -21,7 +21,7 @@ module Pastore
|
|
21
21
|
next if validation_errors.empty?
|
22
22
|
|
23
23
|
if pastore_params.invalid_params_cbk.present?
|
24
|
-
|
24
|
+
instance_exec(validation_errors, &pastore_params.invalid_params_cbk)
|
25
25
|
response.status = pastore_params.response_status
|
26
26
|
else
|
27
27
|
render json: { message: 'Unprocessable Entity', errors: validation_errors }, status: pastore_params.response_status
|
data/lib/pastore/version.rb
CHANGED