reform-rails 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/README.md +1 -1
- data/lib/reform/form/active_model/validations.rb +29 -0
- data/lib/reform/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f960a673533faebc84862cc0a7161d2b8c09c8d9c473af55041b5d9e4cb69fe1
|
4
|
+
data.tar.gz: 6c78405ee3b1a2c27aa24e1afde65b0caf400e4593f9004f22afedd3113d1857
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f4604d9ee1a6850d08968d5ccefec0a32e87a9a5176c92223c51bfadfbd13e268acbb4a3a0902120a209bc2b22095327ec441f3d01948743f7c96b522dc649e
|
7
|
+
data.tar.gz: 86b33a3361e6b8b960d5cc8a3d4bbc21e440fb89a43a09c01308a9c48d8592f354e88637bc01102359bbec32c0c6ba7da82755bafaeab270556b110dbf4df21f
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -14,7 +14,7 @@ Simply don't include this gem if you don't want to use the conventional Reform/R
|
|
14
14
|
|
15
15
|
## Documentation
|
16
16
|
|
17
|
-
The [full documentation](
|
17
|
+
The [full documentation](https://trailblazer.to/2.0/gems/reform/rails.html) can be found on the Trailblazer page.
|
18
18
|
|
19
19
|
## Installation
|
20
20
|
|
@@ -164,6 +164,35 @@ module Reform
|
|
164
164
|
def respond_to?(method)
|
165
165
|
@amv_errors.respond_to?(method) ? true : super
|
166
166
|
end
|
167
|
+
|
168
|
+
def full_messages
|
169
|
+
base_errors = @amv_errors.full_messages
|
170
|
+
form_fields = @amv_errors.instance_variable_get(:@base).instance_variable_get(:@fields)
|
171
|
+
nested_errors = full_messages_for_nested_fields(form_fields)
|
172
|
+
|
173
|
+
[base_errors, nested_errors].flatten.compact
|
174
|
+
end
|
175
|
+
|
176
|
+
private
|
177
|
+
|
178
|
+
def full_messages_for_nested_fields(form_fields)
|
179
|
+
form_fields.map { |field| full_messages_for_twin(field[1]) }
|
180
|
+
end
|
181
|
+
|
182
|
+
def full_messages_for_twin(object)
|
183
|
+
return get_collection_errors(object) if object.is_a? Disposable::Twin::Collection
|
184
|
+
return get_amv_errors(object) if object.is_a? Disposable::Twin
|
185
|
+
|
186
|
+
nil
|
187
|
+
end
|
188
|
+
|
189
|
+
def get_collection_errors(twin_collection)
|
190
|
+
twin_collection.map { |twin| get_amv_errors(twin) }
|
191
|
+
end
|
192
|
+
|
193
|
+
def get_amv_errors(object)
|
194
|
+
object.instance_variable_get(:@amv_errors).full_messages
|
195
|
+
end
|
167
196
|
end
|
168
197
|
end
|
169
198
|
|
data/lib/reform/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reform-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: reform
|