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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbd91d887bce717ba67bfec4b7468fb2e637471bbde99a4b5f84fddb96c3b775
4
- data.tar.gz: 7a935d0e120b5f15f89bddb2bde47d1df126686355fc6210e07611117273c9b4
3
+ metadata.gz: 9b18cf526ca05274e02fa4bcead59a87e4a82e935c2ce7c08a304981576b03ee
4
+ data.tar.gz: b4fce59dffa87a983499371623b889d7fde5a19da094cd297426415233fb0775
5
5
  SHA512:
6
- metadata.gz: cd68dd37a52969a086bd6349ed71fb14f7c4fc6ee21e224d939b9316b34d13b98382042737a8111c9a4ff3d843bcd33df364c7db917255505a1b15f0d28df4dc
7
- data.tar.gz: 13a30ad866732985887d329f6df15af4e4f79b48436cf71eab89dec6939ff1e186ae7d404223f094fbc4f0d05ab2a5b970a37c2fe761aaf27a6d0a00871f2109
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pastore (0.2.0)
4
+ pastore (0.2.1)
5
5
  rails (>= 4.0)
6
6
 
7
7
  GEM
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
  # ...
@@ -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
- instance_eval(&pastore_params.invalid_params_cbk)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pastore
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pastore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Groza Sergiu