validate-params 0.12.1 → 0.12.2

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: 6da9b53b1bcc125e80f19e0a2ba6e3ec9090ce5316202ddcc99472a41f0e77c3
4
- data.tar.gz: c6aa9696e95386c743c3471d1dc4d1f390d44332bf4aee931adb56bdc715bce7
3
+ metadata.gz: 2c090bcb2c38160021c65ed02c85fb8f492bd9e7c8bd75790edb9e7ab4fa51f2
4
+ data.tar.gz: 5ef867403817bae733d94b187e479a133c06d4f9ef201074ee0a7098710aef70
5
5
  SHA512:
6
- metadata.gz: bc0e7388e3e31e70d86319186a0ff3b9e4b31417a1d90e3ee49f5d7308c470960f4eb3c973e68cb31436e5a4fc9e227c26d04ccbdd2918582d80dcd7a439dab0
7
- data.tar.gz: 2c73000905f04bb2a5901a319b62cd13cb7f987b33b66e6382b8a8e6c99f0671eae736d1893ea08a16aaf82b415ad55545975447338e6b61ac007265b5ddc708
6
+ metadata.gz: bce24ad9959b5d8399b532b25a0b19b07193f0d6dbae474dc4fc0d226cde94aa3258bf394ab82cde6445805f1ae94cd2d7947d7a68eadc421eec77b2112e431b
7
+ data.tar.gz: 97cd65a1c24541c3b1b4be12471a6ed7ca57aeebb15bbb467f3c6a097ff63ef81eaf50e64f9dcda79d48db02a87fbfcdf5f5e18b5ed19219e750b9b99c21b88b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- validate-params (0.12.1)
4
+ validate-params (0.12.2)
5
5
  activesupport (>= 6.1.0)
6
6
  i18n (>= 1.6)
7
7
 
@@ -23,6 +23,29 @@ module ValidateParams
23
23
  class_methods do
24
24
  attr_reader :params_validations
25
25
 
26
+ # When controller inherits from other controller, we need to copy the validations.
27
+ #
28
+ # Usage example:
29
+ #
30
+ # class ParentController < ApplicationController
31
+ # validate_params_for :index do |p|
32
+ # p.param :param1, Integer, min: 1, max: 10
33
+ # p.param :param2, Integer, min: 10, max: 20
34
+ # end
35
+ # end
36
+ #
37
+ # class ChildController < ParentController
38
+ # validate_params_for :index do |p|
39
+ # p.param :param1, Integer, min: 0, max: 5
40
+ # end
41
+ # end
42
+ #
43
+ # Here in ChildController, the param1 validation will be overridden, but validation for param2 will remain unchanged.
44
+ #
45
+ def inherited(child)
46
+ child.instance_variable_set("@params_validations", @params_validations.deep_dup)
47
+ end
48
+
26
49
  def validate_params_for(action, options = {})
27
50
  options[:format] ||= :json
28
51
  @params_validations ||= {}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ValidateParams
4
- VERSION = "0.12.1"
4
+ VERSION = "0.12.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validate-params
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - dcherevatenko
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-05 00:00:00.000000000 Z
11
+ date: 2024-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -124,11 +124,11 @@ files:
124
124
  - lib/validate_params/version.rb
125
125
  - sig/validate_params.rbs
126
126
  - validate_params.gemspec
127
- homepage:
127
+ homepage:
128
128
  licenses:
129
129
  - MIT
130
130
  metadata: {}
131
- post_install_message:
131
+ post_install_message:
132
132
  rdoc_options: []
133
133
  require_paths:
134
134
  - lib
@@ -143,8 +143,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  requirements: []
146
- rubygems_version: 3.4.10
147
- signing_key:
146
+ rubygems_version: 3.3.26
147
+ signing_key:
148
148
  specification_version: 4
149
149
  summary: Gem to validate params in controllers
150
150
  test_files: []