client_side_validations 22.0.0 → 22.1.1

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: 554a084e86ce5067b6072f503c4e7814a90502054b1cb282bda8fda183507c8d
4
- data.tar.gz: f4e3365207572aaf71e947c2cb536b8c971eb2b90d18978a3dba3512bd4ede25
3
+ metadata.gz: 98b3863f2e2386f76eadb2b85e9d7f927b98c9b678cdce921711a76ed286c4ba
4
+ data.tar.gz: cd4f16743a959139b498ee519c3f857f4f2f24dfe3fcb0c2b2398640a9bd9131
5
5
  SHA512:
6
- metadata.gz: '09319f96ff691d0295e19d499ff1ed43e85bdc5d9f453fb61d86e4c116e178357d19ea7293f2407b6c25d61ed9cdf5f748f44879816eea74f9637ef7ba098373'
7
- data.tar.gz: 1b79190bed239d7454d8343eec3e61b295d4566e56e34980b19f507450bb592f213948ee7f1415859d1d5f641eefd5feef36773077fabd304571dd1cc50490f8
6
+ metadata.gz: 48958aa9ea9fefcd8c7580d2f1fae4b7804b9f0959e72e29985d154280800e25306ff75c207dbd04785d484620a615466eda801de11ca22f003cc9bfc6ff9d0d
7
+ data.tar.gz: 8294a353659edf7a85ec572cf29b975c5e4c24787ec1b838ab963ae1f44d69ceddc6bfe21bc80b430bf877199e364ffedd6b0416ce0b02124fea478db07a65da
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 22.1.1 / 2023-10-08
4
+
5
+ * [BUGFIX] Fix a bug with missing translations ([#920](https://github.com/DavyJonesLocker/client_side_validations/issues/920))
6
+
7
+ ## 22.1.0 / 2023-10-05
8
+
9
+ * [FEATURE] Rails 7.1 compatibility
10
+
3
11
  ## 22.0.0 / 2023-09-02
4
12
 
5
13
  * [FEATURE] Drop Rails 5.2 and 6.0 support
@@ -28,7 +28,7 @@ module ClientSideValidations
28
28
 
29
29
  def client_side_form_settings(_options, form_helper)
30
30
  {
31
- type: self.class.to_s,
31
+ type: self.class.name,
32
32
  input_tag: error_field(form_helper, :span, 'input_tag'),
33
33
  label_tag: error_field(form_helper, :label, 'label_tag')
34
34
  }
@@ -18,7 +18,24 @@ module ClientSideValidations
18
18
  private
19
19
 
20
20
  def build_client_side_hash(model, attribute, options)
21
- { message: model.errors.generate_message(attribute, message_type, options) }.merge(options.except(*callbacks_options - %i[allow_blank if unless]))
21
+ # Rails mutates `options` object when calling `model.errors.generate_message`
22
+ # by removing `message` option, if any.
23
+ # By raising on missing translations, CSV has the same behavior across
24
+ # all supported Rails versions and `config.i18n.raise_on_missing_translations`
25
+ # possible configurations.
26
+ options[:raise] = true
27
+
28
+ message =
29
+ begin
30
+ model.errors.generate_message(attribute, message_type, options)
31
+ rescue I18n::MissingTranslationData
32
+ options[:message] = :invalid
33
+ model.errors.generate_message(attribute, message_type, options)
34
+ end
35
+
36
+ options.delete(:raise)
37
+
38
+ { message: message }.merge(options.except(*callbacks_options - %i[allow_blank if unless]))
22
39
  end
23
40
 
24
41
  def message_type
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClientSideValidations
4
- VERSION = '22.0.0'
4
+ VERSION = '22.1.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: client_side_validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 22.0.0
4
+ version: 22.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geremia Taglialatela
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-09-02 00:00:00.000000000 Z
12
+ date: 2023-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: js_regex
@@ -34,7 +34,7 @@ dependencies:
34
34
  version: '6.1'
35
35
  - - "<"
36
36
  - !ruby/object:Gem::Version
37
- version: '7.1'
37
+ version: '7.2'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: '6.1'
45
45
  - - "<"
46
46
  - !ruby/object:Gem::Version
47
- version: '7.1'
47
+ version: '7.2'
48
48
  description: Client Side Validations made easy for your Rails 5 applications
49
49
  email:
50
50
  - tagliala.dev@gmail.com