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 +4 -4
- data/README.md +6 -0
- data/lib/unpoly/rails/change.rb +7 -3
- data/lib/unpoly/rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a089240657e59baa74b6a738fbbef9d2ccc1235cf464a355848425beae530ce
|
4
|
+
data.tar.gz: 68af5e14e8d67106a6062d2ff325558cce5fff9decddf90a4e04a3c7de4210f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/unpoly/rails/change.rb
CHANGED
@@ -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
|
-
|
150
|
+
def validate_name
|
151
151
|
if validating?
|
152
|
-
|
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).
|
data/lib/unpoly/rails/version.rb
CHANGED