client_side_validations 22.1.0 → 22.1.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: 0031ae9ccb119721454af916e0b6796104655e332c9617d37c33d34fbaebc24c
4
- data.tar.gz: 6c40bd5b85d1e7d3537e7c37540e2ca09bdcb854c8ea3cf8e7d433d43cbb4fcf
3
+ metadata.gz: 98b3863f2e2386f76eadb2b85e9d7f927b98c9b678cdce921711a76ed286c4ba
4
+ data.tar.gz: cd4f16743a959139b498ee519c3f857f4f2f24dfe3fcb0c2b2398640a9bd9131
5
5
  SHA512:
6
- metadata.gz: 5b366be2677516494cda669b702d017a994f137ebab8372a37de716dc34e504ee46c9fbf3dd665e7427248dc106ce5d29360a7f9f4edb75b821f4fe6a87eebe5
7
- data.tar.gz: 1c27ff9b07dd1face8d867295ff30b2c578244617f885ee3aa57a3b95d5517745b4188b97a19c5889e56846c182e1cd0c9bfc623d222cba972bc365aa6b9faa4
6
+ metadata.gz: 48958aa9ea9fefcd8c7580d2f1fae4b7804b9f0959e72e29985d154280800e25306ff75c207dbd04785d484620a615466eda801de11ca22f003cc9bfc6ff9d0d
7
+ data.tar.gz: 8294a353659edf7a85ec572cf29b975c5e4c24787ec1b838ab963ae1f44d69ceddc6bfe21bc80b430bf877199e364ffedd6b0416ce0b02124fea478db07a65da
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
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
+
3
7
  ## 22.1.0 / 2023-10-05
4
8
 
5
9
  * [FEATURE] Rails 7.1 compatibility
@@ -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.1.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.1.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-10-05 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