unpoly-rails 3.2.2 → 3.2.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: daf4abb8b087b111de90afd35e1d9ff4438ae3b933e996c0d18ff0d0c5c4f45e
4
- data.tar.gz: 6e842eeded7fcdf22368de54a5ebc5b38651273c7daeae24a5380d2e56272f24
3
+ metadata.gz: 1a089240657e59baa74b6a738fbbef9d2ccc1235cf464a355848425beae530ce
4
+ data.tar.gz: 68af5e14e8d67106a6062d2ff325558cce5fff9decddf90a4e04a3c7de4210f7
5
5
  SHA512:
6
- metadata.gz: 8ba599fa01552bc68b252fba438a204ee07d763a2e0c4672067b81dd304c6fb8631562999a7060c681d347da2a38b694b7ddc442368a94489ef2162131aeafa8
7
- data.tar.gz: e7e1a9bc897528d53c9331e0b1961b9b4db336645f8f5ec0065156d809034c3b410a36bffdf74e70b1bf5bc8b2a970e334b8140d1696588f709de315037ac7e1
6
+ metadata.gz: c3109c5e5602d1843569dde42f23756243f73b23b39440bc0b2aa79056f2b44ad68137bb0a497cd929c280c15cfa9718f9d04dee918e7cce76e37f3a6f27041b
7
+ data.tar.gz: ca5c5797a92b7384daed35a190847f72aeb17d1db24e7ebdd587d9b1c7999f946ade25c431c6efd51ad903d35f945350f01eb0cd95fd29b87b1c77da527c6a5e
data/README.md CHANGED
@@ -207,6 +207,12 @@ You may also access the [names of the fields that triggered the validation reque
207
207
  up.validate_names # => ['email', 'password']
208
208
  ```
209
209
 
210
+ You may also test if a given field name is being validated:
211
+
212
+ ```ruby
213
+ up.validate_name?('email') # => true
214
+ ```
215
+
210
216
 
211
217
  ### Detecting a fragment reload
212
218
 
@@ -143,16 +143,20 @@ module Unpoly
143
143
  # the validation.
144
144
  #
145
145
  # Note that multiple validating form fields may be batched into a single request.
146
- def validate_names
146
+ memoize def validate_names
147
147
  validate_names_from_request
148
148
  end
149
149
 
150
- memoize def validate_name
150
+ def validate_name
151
151
  if validating?
152
- validates_names.first
152
+ validate_names.first
153
153
  end
154
154
  end
155
155
 
156
+ def validate_name?(name)
157
+ !!validate_names&.include?(name.to_s)
158
+ end
159
+
156
160
  ##
157
161
  # Returns whether the current form submission should be
158
162
  # [validated](https://unpoly.com/input-up-validate) (and not be saved to the database).
@@ -4,6 +4,6 @@ module Unpoly
4
4
  # The current version of the unpoly-rails gem.
5
5
  # This version number is also used for releases of the Unpoly
6
6
  # frontend code.
7
- VERSION = '3.2.2'
7
+ VERSION = '3.2.2.1'
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unpoly-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.2
4
+ version: 3.2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch