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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a3ec7a5fbc9c096a02983f8043bdbfc15e6c775cbb2454ccf511fdb9eb7c926
4
- data.tar.gz: affb890f0e3bf840901c23b1bbefc33189c54edf24e4f691c4125f97e28d420c
3
+ metadata.gz: f960a673533faebc84862cc0a7161d2b8c09c8d9c473af55041b5d9e4cb69fe1
4
+ data.tar.gz: 6c78405ee3b1a2c27aa24e1afde65b0caf400e4593f9004f22afedd3113d1857
5
5
  SHA512:
6
- metadata.gz: d1fcb80900ffe610a562a471a875530dfb7eee758b47185c20088f47a21e9701452b35532322926011752edf8caf7d401acab2c3079202b6c3bf8b18f32aebd6
7
- data.tar.gz: 9f7b8100901d5b7c8fd6014e02480d447382b8161ed641943f6ef44a6bd53730080d2b48208ade21aaa31b358a74c031492cf17ecbc1b3156c39739faa636848
6
+ metadata.gz: 9f4604d9ee1a6850d08968d5ccefec0a32e87a9a5176c92223c51bfadfbd13e268acbb4a3a0902120a209bc2b22095327ec441f3d01948743f7c96b522dc649e
7
+ data.tar.gz: 86b33a3361e6b8b960d5cc8a3d4bbc21e440fb89a43a09c01308a9c48d8592f354e88637bc01102359bbec32c0c6ba7da82755bafaeab270556b110dbf4df21f
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.2.1
2
+
3
+ * Error's full_message with translation fixed thanks to [@marcelolx](https://github.com/trailblazer/reform-rails/pull/85)
4
+
1
5
  # 0.2.0
2
6
 
3
7
  * Needs Reform >= 2.3.0.
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](http://trailblazer.to/gems/reform/rails.html) can be found on the Trailblazer page.
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
 
@@ -1,5 +1,5 @@
1
1
  module Reform
2
2
  module Rails
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
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.0
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-05-24 00:00:00.000000000 Z
11
+ date: 2020-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reform