reform-rails 0.2.0.rc2 → 0.2.0.rc3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +3 -1
- data/.rubocop.yml +3 -0
- data/.rubocop_todo.yml +661 -0
- data/.travis.yml +27 -19
- data/CHANGES.md +6 -1
- data/Gemfile +26 -8
- data/lib/reform/active_record.rb +1 -1
- data/lib/reform/form/active_model/validations.rb +34 -2
- data/lib/reform/form/active_record.rb +0 -2
- data/lib/reform/form/mongoid.rb +3 -14
- data/lib/reform/form/orm.rb +4 -1
- data/lib/reform/mongoid.rb +1 -1
- data/lib/reform/rails.rb +1 -0
- data/lib/reform/rails/railtie.rb +4 -5
- data/lib/reform/rails/version.rb +1 -1
- data/reform-rails.gemspec +3 -10
- metadata +5 -116
- data/database.sqlite3 +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 4f1ac1e0e188391ad063e8f61c6dafbc25554d8f
|
|
4
|
+
data.tar.gz: 6ddf5369a091079b68013c66c49bda0a4b7d1fe6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 144fd8cb2e456c2af911bd69e7cacd9f198fd17626265cc2dd86296bcf098a03743de2f496b564bad73d4f92412c076290e113220a22398cdc4e03c8e38ac91d
|
|
7
|
+
data.tar.gz: 364f34a9e3ecfadd3fb4edd4e7489888b460f586fecc687fcb2ff75b2df35a74db6ac64818ad262c56641d24ccd1d520eb080299dec4a1d22a2f998b6d126c34
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
# This configuration was generated by
|
|
2
|
+
# `rubocop --auto-gen-config`
|
|
3
|
+
# on 2019-10-31 18:47:53 +1100 using RuboCop version 0.76.0.
|
|
4
|
+
# The point is for the user to remove these configuration records
|
|
5
|
+
# one by one as the offenses are removed from the code base.
|
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
+
|
|
9
|
+
# Offense count: 3
|
|
10
|
+
# Configuration parameters: Include.
|
|
11
|
+
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
|
|
12
|
+
Bundler/DuplicatedGem:
|
|
13
|
+
Exclude:
|
|
14
|
+
- 'Gemfile'
|
|
15
|
+
|
|
16
|
+
# Offense count: 1
|
|
17
|
+
# Cop supports --auto-correct.
|
|
18
|
+
# Configuration parameters: TreatCommentsAsGroupSeparators, Include.
|
|
19
|
+
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
|
|
20
|
+
Bundler/OrderedGems:
|
|
21
|
+
Exclude:
|
|
22
|
+
- 'Gemfile'
|
|
23
|
+
|
|
24
|
+
# Offense count: 1
|
|
25
|
+
# Cop supports --auto-correct.
|
|
26
|
+
# Configuration parameters: TreatCommentsAsGroupSeparators, Include.
|
|
27
|
+
# Include: **/*.gemspec
|
|
28
|
+
Gemspec/OrderedDependencies:
|
|
29
|
+
Exclude:
|
|
30
|
+
- 'reform-rails.gemspec'
|
|
31
|
+
|
|
32
|
+
# Offense count: 5
|
|
33
|
+
# Cop supports --auto-correct.
|
|
34
|
+
# Configuration parameters: IndentationWidth.
|
|
35
|
+
# SupportedStyles: outdent, indent
|
|
36
|
+
Layout/AccessModifierIndentation:
|
|
37
|
+
EnforcedStyle: outdent
|
|
38
|
+
|
|
39
|
+
# Offense count: 13
|
|
40
|
+
# Cop supports --auto-correct.
|
|
41
|
+
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
42
|
+
# SupportedHashRocketStyles: key, separator, table
|
|
43
|
+
# SupportedColonStyles: key, separator, table
|
|
44
|
+
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
45
|
+
Layout/AlignHash:
|
|
46
|
+
Exclude:
|
|
47
|
+
- 'test/activemodel_validation_test.rb'
|
|
48
|
+
- 'test/form_builder_test.rb'
|
|
49
|
+
- 'test/test_helper.rb'
|
|
50
|
+
|
|
51
|
+
# Offense count: 2
|
|
52
|
+
# Cop supports --auto-correct.
|
|
53
|
+
# Configuration parameters: EnforcedStyleAlignWith.
|
|
54
|
+
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
|
55
|
+
Layout/BlockAlignment:
|
|
56
|
+
Exclude:
|
|
57
|
+
- 'reform-rails.gemspec'
|
|
58
|
+
- 'test/activemodel_validation_test.rb'
|
|
59
|
+
|
|
60
|
+
# Offense count: 1
|
|
61
|
+
# Cop supports --auto-correct.
|
|
62
|
+
Layout/BlockEndNewline:
|
|
63
|
+
Exclude:
|
|
64
|
+
- 'test/active_model_custom_validation_translations_test.rb'
|
|
65
|
+
|
|
66
|
+
# Offense count: 2
|
|
67
|
+
# Cop supports --auto-correct.
|
|
68
|
+
Layout/CommentIndentation:
|
|
69
|
+
Exclude:
|
|
70
|
+
- 'lib/reform/form/active_model/validations.rb'
|
|
71
|
+
- 'test/activemodel_validation_test.rb'
|
|
72
|
+
|
|
73
|
+
# Offense count: 2
|
|
74
|
+
# Cop supports --auto-correct.
|
|
75
|
+
Layout/EmptyLineAfterGuardClause:
|
|
76
|
+
Exclude:
|
|
77
|
+
- 'lib/reform/form/active_model.rb'
|
|
78
|
+
- 'lib/reform/form/active_model/model_validations.rb'
|
|
79
|
+
|
|
80
|
+
# Offense count: 1
|
|
81
|
+
# Cop supports --auto-correct.
|
|
82
|
+
Layout/EmptyLineAfterMagicComment:
|
|
83
|
+
Exclude:
|
|
84
|
+
- 'reform-rails.gemspec'
|
|
85
|
+
|
|
86
|
+
# Offense count: 2
|
|
87
|
+
# Cop supports --auto-correct.
|
|
88
|
+
# Configuration parameters: AllowAdjacentOneLineDefs, NumberOfEmptyLines.
|
|
89
|
+
Layout/EmptyLineBetweenDefs:
|
|
90
|
+
Exclude:
|
|
91
|
+
- 'lib/reform/form/active_record.rb'
|
|
92
|
+
- 'lib/reform/form/mongoid.rb'
|
|
93
|
+
|
|
94
|
+
# Offense count: 32
|
|
95
|
+
# Cop supports --auto-correct.
|
|
96
|
+
Layout/EmptyLines:
|
|
97
|
+
Exclude:
|
|
98
|
+
- 'lib/reform/form/active_model.rb'
|
|
99
|
+
- 'lib/reform/form/active_model/validations.rb'
|
|
100
|
+
- 'test/active_model_custom_validation_translations_test.rb'
|
|
101
|
+
- 'test/active_model_test.rb'
|
|
102
|
+
- 'test/active_record_test.rb'
|
|
103
|
+
- 'test/activemodel_validation_test.rb'
|
|
104
|
+
- 'test/form_builder_test.rb'
|
|
105
|
+
- 'test/model_reflections_test.rb'
|
|
106
|
+
- 'test/mongoid_test.rb'
|
|
107
|
+
- 'test/multi_parameter_attributes_test.rb'
|
|
108
|
+
- 'test/test_helper.rb'
|
|
109
|
+
- 'test/unique_test.rb'
|
|
110
|
+
|
|
111
|
+
# Offense count: 3
|
|
112
|
+
# Cop supports --auto-correct.
|
|
113
|
+
# Configuration parameters: EnforcedStyle.
|
|
114
|
+
# SupportedStyles: around, only_before
|
|
115
|
+
Layout/EmptyLinesAroundAccessModifier:
|
|
116
|
+
Exclude:
|
|
117
|
+
- 'lib/reform/form/active_model.rb'
|
|
118
|
+
- 'lib/reform/form/active_model/form_builder_methods.rb'
|
|
119
|
+
- 'lib/reform/form/multi_parameter_attributes.rb'
|
|
120
|
+
|
|
121
|
+
# Offense count: 7
|
|
122
|
+
# Cop supports --auto-correct.
|
|
123
|
+
# Configuration parameters: EnforcedStyle.
|
|
124
|
+
# SupportedStyles: empty_lines, no_empty_lines
|
|
125
|
+
Layout/EmptyLinesAroundBlockBody:
|
|
126
|
+
Exclude:
|
|
127
|
+
- 'test/activemodel_validation_test.rb'
|
|
128
|
+
- 'test/custom_validation_test.rb'
|
|
129
|
+
- 'test/model_validations_test.rb'
|
|
130
|
+
|
|
131
|
+
# Offense count: 10
|
|
132
|
+
# Cop supports --auto-correct.
|
|
133
|
+
# Configuration parameters: EnforcedStyle.
|
|
134
|
+
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
|
|
135
|
+
Layout/EmptyLinesAroundClassBody:
|
|
136
|
+
Exclude:
|
|
137
|
+
- 'lib/reform/form/active_model/model_validations.rb'
|
|
138
|
+
- 'test/active_record_test.rb'
|
|
139
|
+
- 'test/custom_validation_test.rb'
|
|
140
|
+
- 'test/model_validations_test.rb'
|
|
141
|
+
- 'test/mongoid_test.rb'
|
|
142
|
+
|
|
143
|
+
# Offense count: 2
|
|
144
|
+
# Cop supports --auto-correct.
|
|
145
|
+
# Configuration parameters: EnforcedStyle.
|
|
146
|
+
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
|
|
147
|
+
Layout/EmptyLinesAroundModuleBody:
|
|
148
|
+
Exclude:
|
|
149
|
+
- 'lib/reform/form/active_model/model_validations.rb'
|
|
150
|
+
- 'lib/reform/form/active_model/validations.rb'
|
|
151
|
+
|
|
152
|
+
# Offense count: 1
|
|
153
|
+
# Cop supports --auto-correct.
|
|
154
|
+
# Configuration parameters: EnforcedStyleAlignWith, AutoCorrect, Severity.
|
|
155
|
+
# SupportedStylesAlignWith: keyword, variable, start_of_line
|
|
156
|
+
Layout/EndAlignment:
|
|
157
|
+
Exclude:
|
|
158
|
+
- 'test/active_model_test.rb'
|
|
159
|
+
|
|
160
|
+
# Offense count: 4
|
|
161
|
+
# Cop supports --auto-correct.
|
|
162
|
+
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
|
|
163
|
+
Layout/ExtraSpacing:
|
|
164
|
+
Exclude:
|
|
165
|
+
- 'test/active_model_test.rb'
|
|
166
|
+
|
|
167
|
+
# Offense count: 1
|
|
168
|
+
# Cop supports --auto-correct.
|
|
169
|
+
Layout/FirstHashElementLineBreak:
|
|
170
|
+
Exclude:
|
|
171
|
+
- 'test/form_builder_test.rb'
|
|
172
|
+
|
|
173
|
+
# Offense count: 1
|
|
174
|
+
# Cop supports --auto-correct.
|
|
175
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
176
|
+
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
|
177
|
+
Layout/IndentFirstArgument:
|
|
178
|
+
Exclude:
|
|
179
|
+
- 'test/form_builder_test.rb'
|
|
180
|
+
|
|
181
|
+
# Offense count: 10
|
|
182
|
+
# Cop supports --auto-correct.
|
|
183
|
+
# Configuration parameters: EnforcedStyle.
|
|
184
|
+
# SupportedStyles: normal, indented_internal_methods
|
|
185
|
+
Layout/IndentationConsistency:
|
|
186
|
+
Exclude:
|
|
187
|
+
- 'test/active_model_test.rb'
|
|
188
|
+
|
|
189
|
+
# Offense count: 7
|
|
190
|
+
# Cop supports --auto-correct.
|
|
191
|
+
# Configuration parameters: Width, IgnoredPatterns.
|
|
192
|
+
Layout/IndentationWidth:
|
|
193
|
+
Exclude:
|
|
194
|
+
- 'lib/reform/form/active_model/form_builder_methods.rb'
|
|
195
|
+
- 'test/active_model_test.rb'
|
|
196
|
+
|
|
197
|
+
# Offense count: 2
|
|
198
|
+
# Cop supports --auto-correct.
|
|
199
|
+
# Configuration parameters: AllowDoxygenCommentStyle.
|
|
200
|
+
Layout/LeadingCommentSpace:
|
|
201
|
+
Exclude:
|
|
202
|
+
- 'test/docs/**/*'
|
|
203
|
+
- 'test/activemodel_validation_test.rb'
|
|
204
|
+
|
|
205
|
+
# Offense count: 1
|
|
206
|
+
# Cop supports --auto-correct.
|
|
207
|
+
Layout/MultilineBlockLayout:
|
|
208
|
+
Exclude:
|
|
209
|
+
- 'test/active_model_custom_validation_translations_test.rb'
|
|
210
|
+
|
|
211
|
+
# Offense count: 1
|
|
212
|
+
# Cop supports --auto-correct.
|
|
213
|
+
# Configuration parameters: EnforcedStyle.
|
|
214
|
+
# SupportedStyles: symmetrical, new_line, same_line
|
|
215
|
+
Layout/MultilineMethodCallBraceLayout:
|
|
216
|
+
Exclude:
|
|
217
|
+
- 'test/form_builder_test.rb'
|
|
218
|
+
|
|
219
|
+
# Offense count: 1
|
|
220
|
+
# Cop supports --auto-correct.
|
|
221
|
+
Layout/SpaceAfterColon:
|
|
222
|
+
Exclude:
|
|
223
|
+
- 'test/activemodel_validation_test.rb'
|
|
224
|
+
|
|
225
|
+
# Offense count: 7
|
|
226
|
+
# Cop supports --auto-correct.
|
|
227
|
+
Layout/SpaceAfterComma:
|
|
228
|
+
Exclude:
|
|
229
|
+
- 'lib/reform/form/active_model/model_reflections.rb'
|
|
230
|
+
- 'lib/reform/form/active_model/validations.rb'
|
|
231
|
+
- 'test/activemodel_validation_test.rb'
|
|
232
|
+
- 'test/test_helper.rb'
|
|
233
|
+
|
|
234
|
+
# Offense count: 1
|
|
235
|
+
# Cop supports --auto-correct.
|
|
236
|
+
Layout/SpaceAfterNot:
|
|
237
|
+
Exclude:
|
|
238
|
+
- 'lib/reform/form/active_model/validations.rb'
|
|
239
|
+
|
|
240
|
+
# Offense count: 7
|
|
241
|
+
# Cop supports --auto-correct.
|
|
242
|
+
# Configuration parameters: EnforcedStyle.
|
|
243
|
+
# SupportedStyles: space, no_space
|
|
244
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
|
245
|
+
Exclude:
|
|
246
|
+
- 'lib/reform/form/active_model.rb'
|
|
247
|
+
- 'lib/reform/form/active_model/form_builder_methods.rb'
|
|
248
|
+
- 'lib/reform/form/active_model/model_validations.rb'
|
|
249
|
+
- 'lib/reform/form/active_model/validations.rb'
|
|
250
|
+
- 'lib/reform/form/active_record.rb'
|
|
251
|
+
- 'lib/reform/form/mongoid.rb'
|
|
252
|
+
|
|
253
|
+
# Offense count: 1
|
|
254
|
+
# Cop supports --auto-correct.
|
|
255
|
+
Layout/SpaceAroundKeyword:
|
|
256
|
+
Exclude:
|
|
257
|
+
- 'test/active_record_test.rb'
|
|
258
|
+
|
|
259
|
+
# Offense count: 26
|
|
260
|
+
# Cop supports --auto-correct.
|
|
261
|
+
# Configuration parameters: AllowForAlignment.
|
|
262
|
+
Layout/SpaceAroundOperators:
|
|
263
|
+
Exclude:
|
|
264
|
+
- 'test/active_model_test.rb'
|
|
265
|
+
- 'test/active_record_test.rb'
|
|
266
|
+
- 'test/activemodel_validation_test.rb'
|
|
267
|
+
- 'test/form_builder_test.rb'
|
|
268
|
+
- 'test/form_test.rb'
|
|
269
|
+
- 'test/multi_parameter_attributes_test.rb'
|
|
270
|
+
|
|
271
|
+
# Offense count: 1
|
|
272
|
+
# Cop supports --auto-correct.
|
|
273
|
+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
|
274
|
+
# SupportedStyles: space, no_space
|
|
275
|
+
# SupportedStylesForEmptyBraces: space, no_space
|
|
276
|
+
Layout/SpaceBeforeBlockBraces:
|
|
277
|
+
Exclude:
|
|
278
|
+
- 'test/active_model_custom_validation_translations_test.rb'
|
|
279
|
+
|
|
280
|
+
# Offense count: 2
|
|
281
|
+
# Cop supports --auto-correct.
|
|
282
|
+
Layout/SpaceBeforeComment:
|
|
283
|
+
Exclude:
|
|
284
|
+
- 'test/activemodel_validation_test.rb'
|
|
285
|
+
|
|
286
|
+
# Offense count: 3
|
|
287
|
+
# Cop supports --auto-correct.
|
|
288
|
+
# Configuration parameters: AllowForAlignment.
|
|
289
|
+
Layout/SpaceBeforeFirstArg:
|
|
290
|
+
Exclude:
|
|
291
|
+
- 'test/active_model_test.rb'
|
|
292
|
+
- 'test/activemodel_validation_test.rb'
|
|
293
|
+
|
|
294
|
+
# Offense count: 19
|
|
295
|
+
# Cop supports --auto-correct.
|
|
296
|
+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
|
297
|
+
# SupportedStyles: space, no_space
|
|
298
|
+
# SupportedStylesForEmptyBraces: space, no_space
|
|
299
|
+
Layout/SpaceInsideBlockBraces:
|
|
300
|
+
Exclude:
|
|
301
|
+
- 'test/activemodel_validation_test.rb'
|
|
302
|
+
- 'test/mongoid_test.rb'
|
|
303
|
+
|
|
304
|
+
# Offense count: 34
|
|
305
|
+
# Cop supports --auto-correct.
|
|
306
|
+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
|
307
|
+
# SupportedStyles: space, no_space, compact
|
|
308
|
+
# SupportedStylesForEmptyBraces: space, no_space
|
|
309
|
+
Layout/SpaceInsideHashLiteralBraces:
|
|
310
|
+
Exclude:
|
|
311
|
+
- 'test/active_model_validation_for_property_named_format_test.rb'
|
|
312
|
+
- 'test/activemodel_validation_test.rb'
|
|
313
|
+
- 'test/form_test.rb'
|
|
314
|
+
- 'test/model_validations_test.rb'
|
|
315
|
+
- 'test/multi_parameter_attributes_test.rb'
|
|
316
|
+
- 'test/unique_test.rb'
|
|
317
|
+
|
|
318
|
+
# Offense count: 3
|
|
319
|
+
# Cop supports --auto-correct.
|
|
320
|
+
# Configuration parameters: EnforcedStyle.
|
|
321
|
+
# SupportedStyles: final_newline, final_blank_line
|
|
322
|
+
Layout/TrailingBlankLines:
|
|
323
|
+
Exclude:
|
|
324
|
+
- 'lib/reform/form/active_model/form_builder_methods.rb'
|
|
325
|
+
- 'test/active_record_test.rb'
|
|
326
|
+
- 'test/model_validations_test.rb'
|
|
327
|
+
|
|
328
|
+
# Offense count: 4
|
|
329
|
+
Lint/AmbiguousOperator:
|
|
330
|
+
Exclude:
|
|
331
|
+
- 'lib/reform/form/active_model.rb'
|
|
332
|
+
|
|
333
|
+
# Offense count: 1
|
|
334
|
+
# Configuration parameters: AllowSafeAssignment.
|
|
335
|
+
Lint/AssignmentInCondition:
|
|
336
|
+
Exclude:
|
|
337
|
+
- 'lib/reform/form/multi_parameter_attributes.rb'
|
|
338
|
+
|
|
339
|
+
# Offense count: 55
|
|
340
|
+
Lint/ParenthesesAsGroupedExpression:
|
|
341
|
+
Exclude:
|
|
342
|
+
- 'test/active_model_test.rb'
|
|
343
|
+
- 'test/active_record_test.rb'
|
|
344
|
+
- 'test/activemodel_validation_test.rb'
|
|
345
|
+
- 'test/form_builder_test.rb'
|
|
346
|
+
- 'test/model_reflections_test.rb'
|
|
347
|
+
- 'test/mongoid_test.rb'
|
|
348
|
+
- 'test/multi_parameter_attributes_test.rb'
|
|
349
|
+
- 'test/test_helper.rb'
|
|
350
|
+
- 'test/unique_test.rb'
|
|
351
|
+
|
|
352
|
+
# Offense count: 1
|
|
353
|
+
# Cop supports --auto-correct.
|
|
354
|
+
Lint/RedundantSplatExpansion:
|
|
355
|
+
Exclude:
|
|
356
|
+
- 'lib/reform/form/active_model.rb'
|
|
357
|
+
|
|
358
|
+
# Offense count: 1
|
|
359
|
+
# Configuration parameters: AllowKeywordBlockArguments.
|
|
360
|
+
Lint/UnderscorePrefixedVariableName:
|
|
361
|
+
Exclude:
|
|
362
|
+
- 'lib/reform/form/active_model.rb'
|
|
363
|
+
|
|
364
|
+
# Offense count: 3
|
|
365
|
+
# Cop supports --auto-correct.
|
|
366
|
+
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
|
367
|
+
Lint/UnusedBlockArgument:
|
|
368
|
+
Exclude:
|
|
369
|
+
- 'lib/reform/form/active_model/model_reflections.rb'
|
|
370
|
+
- 'lib/reform/form/orm.rb'
|
|
371
|
+
- 'test/activemodel_validation_test.rb'
|
|
372
|
+
|
|
373
|
+
# Offense count: 1
|
|
374
|
+
# Cop supports --auto-correct.
|
|
375
|
+
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
|
|
376
|
+
Lint/UnusedMethodArgument:
|
|
377
|
+
Exclude:
|
|
378
|
+
- 'lib/reform/form/active_model/validations.rb'
|
|
379
|
+
|
|
380
|
+
# Offense count: 1
|
|
381
|
+
Lint/UselessAssignment:
|
|
382
|
+
Exclude:
|
|
383
|
+
- 'test/unique_test.rb'
|
|
384
|
+
|
|
385
|
+
# Offense count: 1
|
|
386
|
+
Metrics/AbcSize:
|
|
387
|
+
Max: 26
|
|
388
|
+
|
|
389
|
+
# Offense count: 1
|
|
390
|
+
# Configuration parameters: CountComments.
|
|
391
|
+
Metrics/ClassLength:
|
|
392
|
+
Max: 152
|
|
393
|
+
|
|
394
|
+
# Offense count: 23
|
|
395
|
+
# Cop supports --auto-correct.
|
|
396
|
+
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
|
397
|
+
# URISchemes: http, https
|
|
398
|
+
Metrics/LineLength:
|
|
399
|
+
Max: 262
|
|
400
|
+
|
|
401
|
+
# Offense count: 1
|
|
402
|
+
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
|
|
403
|
+
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
|
|
404
|
+
Naming/MemoizedInstanceVariableName:
|
|
405
|
+
Exclude:
|
|
406
|
+
- 'lib/reform/form/active_model/validations.rb'
|
|
407
|
+
|
|
408
|
+
# Offense count: 2
|
|
409
|
+
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist, MethodDefinitionMacros.
|
|
410
|
+
# NamePrefix: is_, has_, have_
|
|
411
|
+
# NamePrefixBlacklist: is_, has_, have_
|
|
412
|
+
# NameWhitelist: is_a?
|
|
413
|
+
# MethodDefinitionMacros: define_method, define_singleton_method
|
|
414
|
+
Naming/PredicateName:
|
|
415
|
+
Exclude:
|
|
416
|
+
- 'spec/**/*'
|
|
417
|
+
- 'lib/reform/form/active_model/model_reflections.rb'
|
|
418
|
+
- 'test/model_reflections_test.rb'
|
|
419
|
+
|
|
420
|
+
# Offense count: 6
|
|
421
|
+
# Configuration parameters: EnforcedStyle.
|
|
422
|
+
# SupportedStyles: snake_case, normalcase, non_integer
|
|
423
|
+
Naming/VariableNumber:
|
|
424
|
+
Exclude:
|
|
425
|
+
- 'test/unique_test.rb'
|
|
426
|
+
|
|
427
|
+
# Offense count: 9
|
|
428
|
+
# Cop supports --auto-correct.
|
|
429
|
+
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners.
|
|
430
|
+
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
|
431
|
+
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
|
432
|
+
# FunctionalMethods: let, let!, subject, watch
|
|
433
|
+
# IgnoredMethods: lambda, proc, it
|
|
434
|
+
Style/BlockDelimiters:
|
|
435
|
+
Exclude:
|
|
436
|
+
- 'test/active_model_test.rb'
|
|
437
|
+
- 'test/active_record_test.rb'
|
|
438
|
+
- 'test/form_builder_test.rb'
|
|
439
|
+
- 'test/mongoid_test.rb'
|
|
440
|
+
|
|
441
|
+
# Offense count: 21
|
|
442
|
+
# Cop supports --auto-correct.
|
|
443
|
+
# Configuration parameters: EnforcedStyle.
|
|
444
|
+
# SupportedStyles: braces, no_braces, context_dependent
|
|
445
|
+
Style/BracesAroundHashParameters:
|
|
446
|
+
Exclude:
|
|
447
|
+
- 'lib/reform/form/active_model/model_validations.rb'
|
|
448
|
+
- 'test/active_model_validation_for_property_named_format_test.rb'
|
|
449
|
+
- 'test/active_record_test.rb'
|
|
450
|
+
- 'test/activemodel_validation_test.rb'
|
|
451
|
+
- 'test/form_test.rb'
|
|
452
|
+
- 'test/mongoid_test.rb'
|
|
453
|
+
- 'test/unique_test.rb'
|
|
454
|
+
|
|
455
|
+
# Offense count: 8
|
|
456
|
+
Style/CommentedKeyword:
|
|
457
|
+
Exclude:
|
|
458
|
+
- 'lib/reform/form/active_model.rb'
|
|
459
|
+
- 'lib/reform/form/active_model/validations.rb'
|
|
460
|
+
- 'lib/reform/rails/railtie.rb'
|
|
461
|
+
- 'test/active_model_test.rb'
|
|
462
|
+
- 'test/activemodel_validation_test.rb'
|
|
463
|
+
|
|
464
|
+
# Offense count: 1
|
|
465
|
+
# Cop supports --auto-correct.
|
|
466
|
+
Style/Encoding:
|
|
467
|
+
Exclude:
|
|
468
|
+
- 'reform-rails.gemspec'
|
|
469
|
+
|
|
470
|
+
# Offense count: 1
|
|
471
|
+
# Cop supports --auto-correct.
|
|
472
|
+
Style/ExpandPathArguments:
|
|
473
|
+
Exclude:
|
|
474
|
+
- 'reform-rails.gemspec'
|
|
475
|
+
|
|
476
|
+
# Offense count: 2
|
|
477
|
+
# Configuration parameters: MinBodyLength.
|
|
478
|
+
Style/GuardClause:
|
|
479
|
+
Exclude:
|
|
480
|
+
- 'lib/reform/form/active_model/model_validations.rb'
|
|
481
|
+
- 'test/custom_validation_test.rb'
|
|
482
|
+
|
|
483
|
+
# Offense count: 2
|
|
484
|
+
Style/IdenticalConditionalBranches:
|
|
485
|
+
Exclude:
|
|
486
|
+
- 'lib/reform/form/active_model.rb'
|
|
487
|
+
|
|
488
|
+
# Offense count: 1
|
|
489
|
+
# Configuration parameters: AllowIfModifier.
|
|
490
|
+
Style/IfInsideElse:
|
|
491
|
+
Exclude:
|
|
492
|
+
- 'lib/reform/form/active_model.rb'
|
|
493
|
+
|
|
494
|
+
# Offense count: 7
|
|
495
|
+
# Cop supports --auto-correct.
|
|
496
|
+
Style/IfUnlessModifier:
|
|
497
|
+
Exclude:
|
|
498
|
+
- 'lib/reform/form/active_model/model_validations.rb'
|
|
499
|
+
- 'lib/reform/form/multi_parameter_attributes.rb'
|
|
500
|
+
- 'lib/reform/form/validation/unique_validator.rb'
|
|
501
|
+
- 'test/activemodel_validation_test.rb'
|
|
502
|
+
- 'test/custom_validation_test.rb'
|
|
503
|
+
|
|
504
|
+
# Offense count: 1
|
|
505
|
+
Style/ImplicitRuntimeError:
|
|
506
|
+
Exclude:
|
|
507
|
+
- 'lib/reform/form/active_model/model_validations.rb'
|
|
508
|
+
|
|
509
|
+
# Offense count: 2
|
|
510
|
+
# Cop supports --auto-correct.
|
|
511
|
+
# Configuration parameters: EnforcedStyle.
|
|
512
|
+
# SupportedStyles: line_count_dependent, lambda, literal
|
|
513
|
+
Style/Lambda:
|
|
514
|
+
Exclude:
|
|
515
|
+
- 'test/activemodel_validation_test.rb'
|
|
516
|
+
|
|
517
|
+
# Offense count: 2
|
|
518
|
+
Style/MethodCalledOnDoEndBlock:
|
|
519
|
+
Exclude:
|
|
520
|
+
- 'test/active_record_test.rb'
|
|
521
|
+
- 'test/mongoid_test.rb'
|
|
522
|
+
|
|
523
|
+
# Offense count: 3
|
|
524
|
+
# Cop supports --auto-correct.
|
|
525
|
+
# Configuration parameters: EnforcedStyle.
|
|
526
|
+
# SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
|
|
527
|
+
Style/MethodDefParentheses:
|
|
528
|
+
Exclude:
|
|
529
|
+
- 'lib/reform/form/active_model/model_validations.rb'
|
|
530
|
+
- 'test/custom_validation_test.rb'
|
|
531
|
+
|
|
532
|
+
# Offense count: 2
|
|
533
|
+
Style/MethodMissingSuper:
|
|
534
|
+
Exclude:
|
|
535
|
+
- 'lib/reform/form/active_model/validations.rb'
|
|
536
|
+
|
|
537
|
+
# Offense count: 1
|
|
538
|
+
# Configuration parameters: EnforcedStyle.
|
|
539
|
+
# SupportedStyles: if, case, both
|
|
540
|
+
Style/MissingElse:
|
|
541
|
+
Exclude:
|
|
542
|
+
- 'Gemfile'
|
|
543
|
+
|
|
544
|
+
# Offense count: 2
|
|
545
|
+
Style/MissingRespondToMissing:
|
|
546
|
+
Exclude:
|
|
547
|
+
- 'lib/reform/form/active_model/validations.rb'
|
|
548
|
+
|
|
549
|
+
# Offense count: 1
|
|
550
|
+
Style/MultilineTernaryOperator:
|
|
551
|
+
Exclude:
|
|
552
|
+
- 'lib/reform/form/multi_parameter_attributes.rb'
|
|
553
|
+
|
|
554
|
+
# Offense count: 1
|
|
555
|
+
# Cop supports --auto-correct.
|
|
556
|
+
# Configuration parameters: EnforcedStyle.
|
|
557
|
+
# SupportedStyles: literals, strict
|
|
558
|
+
Style/MutableConstant:
|
|
559
|
+
Exclude:
|
|
560
|
+
- 'lib/reform/rails/version.rb'
|
|
561
|
+
|
|
562
|
+
# Offense count: 5
|
|
563
|
+
# Cop supports --auto-correct.
|
|
564
|
+
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
|
|
565
|
+
# SupportedStyles: predicate, comparison
|
|
566
|
+
Style/NumericPredicate:
|
|
567
|
+
Exclude:
|
|
568
|
+
- 'spec/**/*'
|
|
569
|
+
- 'lib/reform/form/validation/unique_validator.rb'
|
|
570
|
+
- 'test/active_record_test.rb'
|
|
571
|
+
- 'test/mongoid_test.rb'
|
|
572
|
+
|
|
573
|
+
# Offense count: 3
|
|
574
|
+
# Configuration parameters: SuspiciousParamNames.
|
|
575
|
+
# SuspiciousParamNames: options, opts, args, params, parameters
|
|
576
|
+
Style/OptionHash:
|
|
577
|
+
Exclude:
|
|
578
|
+
- 'lib/reform/form/active_model.rb'
|
|
579
|
+
- 'lib/reform/form/active_record.rb'
|
|
580
|
+
- 'lib/reform/form/mongoid.rb'
|
|
581
|
+
|
|
582
|
+
# Offense count: 3
|
|
583
|
+
# Cop supports --auto-correct.
|
|
584
|
+
# Configuration parameters: PreferredDelimiters.
|
|
585
|
+
Style/PercentLiteralDelimiters:
|
|
586
|
+
Exclude:
|
|
587
|
+
- 'reform-rails.gemspec'
|
|
588
|
+
- 'test/form_builder_test.rb'
|
|
589
|
+
|
|
590
|
+
# Offense count: 3
|
|
591
|
+
# Cop supports --auto-correct.
|
|
592
|
+
# Configuration parameters: EnforcedStyle.
|
|
593
|
+
# SupportedStyles: short, verbose
|
|
594
|
+
Style/PreferredHashMethods:
|
|
595
|
+
Exclude:
|
|
596
|
+
- 'lib/reform/form/active_model/form_builder_methods.rb'
|
|
597
|
+
- 'lib/reform/form/active_model/model_validations.rb'
|
|
598
|
+
|
|
599
|
+
# Offense count: 1
|
|
600
|
+
# Cop supports --auto-correct.
|
|
601
|
+
Style/RedundantInterpolation:
|
|
602
|
+
Exclude:
|
|
603
|
+
- 'test/active_model_test.rb'
|
|
604
|
+
|
|
605
|
+
# Offense count: 2
|
|
606
|
+
# Cop supports --auto-correct.
|
|
607
|
+
Style/RedundantPercentQ:
|
|
608
|
+
Exclude:
|
|
609
|
+
- 'reform-rails.gemspec'
|
|
610
|
+
|
|
611
|
+
# Offense count: 1
|
|
612
|
+
# Cop supports --auto-correct.
|
|
613
|
+
# Configuration parameters: EnforcedStyle.
|
|
614
|
+
# SupportedStyles: return, return_nil
|
|
615
|
+
Style/ReturnNil:
|
|
616
|
+
Exclude:
|
|
617
|
+
- 'lib/reform/form/multi_parameter_attributes.rb'
|
|
618
|
+
|
|
619
|
+
# Offense count: 7
|
|
620
|
+
Style/Send:
|
|
621
|
+
Exclude:
|
|
622
|
+
- 'lib/reform/form/active_model/model_reflections.rb'
|
|
623
|
+
- 'lib/reform/form/active_model/validations.rb'
|
|
624
|
+
- 'lib/reform/form/orm.rb'
|
|
625
|
+
- 'lib/reform/form/validation/unique_validator.rb'
|
|
626
|
+
|
|
627
|
+
# Offense count: 1
|
|
628
|
+
# Cop supports --auto-correct.
|
|
629
|
+
# Configuration parameters: EnforcedStyle.
|
|
630
|
+
# SupportedStyles: only_raise, only_fail, semantic
|
|
631
|
+
Style/SignalException:
|
|
632
|
+
Exclude:
|
|
633
|
+
- 'lib/reform/form/active_model/model_validations.rb'
|
|
634
|
+
|
|
635
|
+
# Offense count: 133
|
|
636
|
+
# Cop supports --auto-correct.
|
|
637
|
+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
|
638
|
+
# SupportedStyles: single_quotes, double_quotes
|
|
639
|
+
Style/StringLiterals:
|
|
640
|
+
Enabled: false
|
|
641
|
+
|
|
642
|
+
# Offense count: 4
|
|
643
|
+
# Cop supports --auto-correct.
|
|
644
|
+
# Configuration parameters: MinSize.
|
|
645
|
+
# SupportedStyles: percent, brackets
|
|
646
|
+
Style/SymbolArray:
|
|
647
|
+
EnforcedStyle: brackets
|
|
648
|
+
|
|
649
|
+
# Offense count: 2
|
|
650
|
+
# Cop supports --auto-correct.
|
|
651
|
+
# Configuration parameters: EnforcedStyle, MinSize, WordRegex.
|
|
652
|
+
# SupportedStyles: percent, brackets
|
|
653
|
+
Style/WordArray:
|
|
654
|
+
Exclude:
|
|
655
|
+
- 'test/activemodel_validation_test.rb'
|
|
656
|
+
|
|
657
|
+
# Offense count: 2
|
|
658
|
+
# Cop supports --auto-correct.
|
|
659
|
+
Style/ZeroLengthPredicate:
|
|
660
|
+
Exclude:
|
|
661
|
+
- 'test/mongoid_test.rb'
|
data/.travis.yml
CHANGED
|
@@ -1,30 +1,38 @@
|
|
|
1
1
|
language: ruby
|
|
2
2
|
cache: bundler
|
|
3
|
-
|
|
3
|
+
before_install:
|
|
4
|
+
- gem update --system
|
|
5
|
+
- gem install bundler
|
|
4
6
|
rvm:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
- 2.4.0
|
|
7
|
+
- 2.4.6
|
|
8
|
+
- 2.5.5
|
|
9
|
+
- 2.6.3
|
|
9
10
|
services:
|
|
10
11
|
- mongodb
|
|
11
12
|
env:
|
|
12
|
-
- "RAILS_VERSION=
|
|
13
|
-
- "RAILS_VERSION=
|
|
14
|
-
- "RAILS_VERSION=4.1.0"
|
|
15
|
-
- "RAILS_VERSION=4.2.0"
|
|
16
|
-
- "RAILS_VERSION=5.0.0"
|
|
13
|
+
- "RAILS_VERSION=6.0.0"
|
|
14
|
+
- "RAILS_VERSION=5.2.0"
|
|
17
15
|
- "RAILS_VERSION=5.1.0"
|
|
16
|
+
- "RAILS_VERSION=5.0.0"
|
|
17
|
+
- "RAILS_VERSION=4.2.0"
|
|
18
|
+
- "RAILS_VERSION=4.1.0"
|
|
19
|
+
- "RAILS_VERSION=4.0.0"
|
|
18
20
|
matrix:
|
|
19
21
|
fast_finish: true
|
|
20
22
|
exclude:
|
|
21
|
-
- rvm: 2.
|
|
22
|
-
env: "RAILS_VERSION=
|
|
23
|
-
- rvm: 2.
|
|
24
|
-
env: "RAILS_VERSION=
|
|
25
|
-
- rvm: 2.4.
|
|
26
|
-
env: "RAILS_VERSION=
|
|
27
|
-
|
|
23
|
+
- rvm: 2.4.6
|
|
24
|
+
env: "RAILS_VERSION=4.0.0"
|
|
25
|
+
- rvm: 2.4.6
|
|
26
|
+
env: "RAILS_VERSION=4.1.0"
|
|
27
|
+
- rvm: 2.4.6
|
|
28
|
+
env: "RAILS_VERSION=6.0.0"
|
|
29
|
+
|
|
30
|
+
- rvm: 2.5.5
|
|
31
|
+
env: "RAILS_VERSION=4.0.0"
|
|
32
|
+
- rvm: 2.5.5
|
|
33
|
+
env: "RAILS_VERSION=4.1.0"
|
|
34
|
+
|
|
35
|
+
- rvm: 2.6.3
|
|
28
36
|
env: "RAILS_VERSION=4.0.0"
|
|
29
|
-
- rvm: 2.
|
|
30
|
-
env: "RAILS_VERSION=4.1.0"
|
|
37
|
+
- rvm: 2.6.3
|
|
38
|
+
env: "RAILS_VERSION=4.1.0"
|
data/CHANGES.md
CHANGED
|
@@ -7,8 +7,13 @@
|
|
|
7
7
|
* fix bug in uniqueness validation where form has different attribute name to column
|
|
8
8
|
* improve handling of persisted records in uniqueness validator
|
|
9
9
|
* remove params.merge! as it's deprecated in rails 5
|
|
10
|
-
* update to support reform 2.3, the new API means that `errors.add` is delegated to ActiveModel::Errors
|
|
10
|
+
* update to support reform 2.3, the new API means that `errors.add` is delegated to ActiveModel::Errors to support rails 5
|
|
11
11
|
* Fix nested form validation (#53)
|
|
12
|
+
* Errors supports symbol and string lookup (PR #77)
|
|
13
|
+
* Implement respond_to that delegates to AMV errors (PR #78)
|
|
14
|
+
|
|
15
|
+
# 0.1.8
|
|
16
|
+
* Drop support to mongoid < 4.
|
|
12
17
|
|
|
13
18
|
# 0.1.7 (0.1.6 Yanked)
|
|
14
19
|
|
data/Gemfile
CHANGED
|
@@ -1,17 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
git_source(:github) do |repo_name|
|
|
2
|
+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
|
3
|
+
"https://github.com/#{repo_name}.git"
|
|
4
|
+
end
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
source "https://rubygems.org"
|
|
4
7
|
gemspec
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
gem 'pry-byebug'
|
|
10
|
+
gem "minitest-line"
|
|
11
|
+
|
|
12
|
+
case ENV["GEMS_SOURCE"]
|
|
13
|
+
when "local"
|
|
14
|
+
gem "reform", path: "../reform"
|
|
15
|
+
when "github"
|
|
16
|
+
gem "reform", github: "trailblazer/reform"
|
|
17
|
+
end
|
|
8
18
|
|
|
9
|
-
rails_version = ENV
|
|
19
|
+
rails_version = ENV.fetch("RAILS_VERSION", "5.2.0")
|
|
10
20
|
|
|
11
21
|
# bored of wrestling with rails...
|
|
12
|
-
if rails_version
|
|
13
|
-
gem
|
|
22
|
+
if rails_version.include? "4.0"
|
|
23
|
+
gem "mongoid", "~> 4"
|
|
24
|
+
else
|
|
25
|
+
gem("mongoid", "< 7.0") unless rails_version.include?('6.0')
|
|
14
26
|
end
|
|
15
27
|
|
|
16
|
-
gem "railties", "~> #{rails_version}"
|
|
17
28
|
gem "activerecord", "~> #{rails_version}"
|
|
29
|
+
gem "railties", "~> #{rails_version}"
|
|
30
|
+
if rails_version.include?('6.0')
|
|
31
|
+
gem "sqlite3", "~> 1.4"
|
|
32
|
+
else
|
|
33
|
+
gem "sqlite3", "~> 1.3", "< 1.4"
|
|
34
|
+
end
|
|
35
|
+
puts "Rails version #{rails_version}"
|
data/lib/reform/active_record.rb
CHANGED
|
@@ -52,12 +52,24 @@ module Reform
|
|
|
52
52
|
@amv_errors
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
+
def custom_errors
|
|
56
|
+
# required to keep update the ActiveModel::Errors#details used to test for
|
|
57
|
+
# added errors ActiveModel::Errors#added? and needs to be inside this block!
|
|
58
|
+
super.each do |custom_error|
|
|
59
|
+
errors = custom_error.errors
|
|
60
|
+
# CustomError build always the errors with an hash where the value is an array
|
|
61
|
+
errors.values.first.each do |value|
|
|
62
|
+
@amv_errors.add(errors.keys.first, value)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
55
67
|
def validate!(params, pointers=[])
|
|
56
68
|
@amv_errors = ActiveModel::Errors.new(self)
|
|
57
69
|
|
|
58
70
|
super.tap do
|
|
59
71
|
# @fran: super ugly hack thanks to the shit architecture of AMV. let's drop it in 3.0 and move on!
|
|
60
|
-
all_errors = @result.
|
|
72
|
+
all_errors = @result.to_results
|
|
61
73
|
nested_errors = @result.instance_variable_get(:@failure)
|
|
62
74
|
|
|
63
75
|
@result = Reform::Contract::Result.new(all_errors, [nested_errors].compact)
|
|
@@ -121,7 +133,7 @@ module Reform
|
|
|
121
133
|
end
|
|
122
134
|
|
|
123
135
|
def [](k)
|
|
124
|
-
super || []
|
|
136
|
+
super(k.to_sym) || []
|
|
125
137
|
end
|
|
126
138
|
|
|
127
139
|
# rails expects this to return a stringified hash of the messages
|
|
@@ -129,9 +141,29 @@ module Reform
|
|
|
129
141
|
messages.to_s
|
|
130
142
|
end
|
|
131
143
|
|
|
144
|
+
def add(key, error_text)
|
|
145
|
+
# use rails magic to get the correct error_text and make sure we still update details and fields
|
|
146
|
+
text = @amv_errors.add(key, error_text)
|
|
147
|
+
|
|
148
|
+
# using error_text instead of text to either keep the symbol which will be
|
|
149
|
+
# magically replaced with the translate or directly the string - this is also
|
|
150
|
+
# required otherwise in the custom_errors method we will add the actual message in the
|
|
151
|
+
# ActiveModel::Errors#details which is not correct if a symbol was passed here
|
|
152
|
+
Reform::Contract::CustomError.new(key, error_text, @result.to_results)
|
|
153
|
+
|
|
154
|
+
# but since messages method is actually already defined in `Reform::Contract::Result::Errors
|
|
155
|
+
# we need to update the @dotted_errors instance variable to add or merge a new error
|
|
156
|
+
@dotted_errors.key?(key) ? @dotted_errors[key] |= text : @dotted_errors[key] = text
|
|
157
|
+
instance_variable_set(:@dotted_errors, @dotted_errors)
|
|
158
|
+
end
|
|
159
|
+
|
|
132
160
|
def method_missing(m, *args, &block)
|
|
133
161
|
@amv_errors.send(m, *args, &block) # send all methods to the AMV errors, even privates.
|
|
134
162
|
end
|
|
163
|
+
|
|
164
|
+
def respond_to?(method)
|
|
165
|
+
@amv_errors.respond_to?(method) ? true : super
|
|
166
|
+
end
|
|
135
167
|
end
|
|
136
168
|
end
|
|
137
169
|
|
data/lib/reform/form/mongoid.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
gem 'mongoid', ">= 4.0"
|
|
2
|
+
|
|
1
3
|
module Reform::Form::Mongoid
|
|
2
4
|
def self.included(base)
|
|
3
5
|
base.class_eval do
|
|
@@ -18,20 +20,7 @@ module Reform::Form::Mongoid
|
|
|
18
20
|
end
|
|
19
21
|
end
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
def self.mongoid_namespace
|
|
23
|
-
if mongoid_is_4_or_more?
|
|
24
|
-
'Validatable'
|
|
25
|
-
else
|
|
26
|
-
'Validations'
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def self.mongoid_is_4_or_more?
|
|
31
|
-
Mongoid::VERSION.split('.').first.to_i >= 4
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
UniquenessValidator = Class.new("::Mongoid::#{mongoid_namespace}::UniquenessValidator".constantize) do
|
|
23
|
+
UniquenessValidator = Class.new("::Mongoid::Validatable::UniquenessValidator".constantize) do
|
|
35
24
|
include Reform::Form::ORM::UniquenessValidator
|
|
36
25
|
end
|
|
37
26
|
end
|
data/lib/reform/form/orm.rb
CHANGED
|
@@ -19,7 +19,10 @@ module Reform::Form::ORM
|
|
|
19
19
|
|
|
20
20
|
@klass = record.class # this is usually done in the super-sucky #setup method.
|
|
21
21
|
super(record).tap do |res|
|
|
22
|
-
|
|
22
|
+
if record.errors.present?
|
|
23
|
+
error = self.class.name.include?("Mongoid") ? record.errors.first.last : :taken
|
|
24
|
+
form.errors.add(property, error)
|
|
25
|
+
end
|
|
23
26
|
end
|
|
24
27
|
end
|
|
25
28
|
end
|
data/lib/reform/mongoid.rb
CHANGED
data/lib/reform/rails.rb
CHANGED
data/lib/reform/rails/railtie.rb
CHANGED
|
@@ -6,7 +6,6 @@ module Reform
|
|
|
6
6
|
initializer "reform.form_extensions", after: :load_config_initializers do
|
|
7
7
|
validations = config.reform.validations || :active_model
|
|
8
8
|
|
|
9
|
-
require "reform"
|
|
10
9
|
require "reform/form/multi_parameter_attributes"
|
|
11
10
|
|
|
12
11
|
if validations == :active_model
|
|
@@ -27,14 +26,14 @@ module Reform
|
|
|
27
26
|
require "reform/form/active_model/model_validations"
|
|
28
27
|
require "reform/form/active_model/validations"
|
|
29
28
|
|
|
30
|
-
require "reform/active_record" if defined?(ActiveRecord)
|
|
31
|
-
require "reform/mongoid" if defined?(Mongoid)
|
|
29
|
+
require "reform/active_record" if defined?(::ActiveRecord)
|
|
30
|
+
require "reform/mongoid" if defined?(::Mongoid)
|
|
32
31
|
|
|
33
32
|
Reform::Form.class_eval do
|
|
34
33
|
include Reform::Form::ActiveModel
|
|
35
34
|
include Reform::Form::ActiveModel::FormBuilderMethods
|
|
36
|
-
include Reform::Form::ActiveRecord if defined?(ActiveRecord)
|
|
37
|
-
include Reform::Form::Mongoid if defined?(Mongoid)
|
|
35
|
+
include Reform::Form::ActiveRecord if defined?(::ActiveRecord)
|
|
36
|
+
include Reform::Form::Mongoid if defined?(::Mongoid)
|
|
38
37
|
include Reform::Form::ActiveModel::Validations
|
|
39
38
|
end
|
|
40
39
|
end
|
data/lib/reform/rails/version.rb
CHANGED
data/reform-rails.gemspec
CHANGED
|
@@ -14,19 +14,12 @@ Gem::Specification.new do |spec|
|
|
|
14
14
|
spec.homepage = "https://github.com/trailblazer/reform-rails"
|
|
15
15
|
spec.license = "MIT"
|
|
16
16
|
|
|
17
|
-
spec.files = `git ls-files -z`.split("\x0").reject
|
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
18
|
+
f.match(%r{^(test/|spec/|features/|database.sqlite3)})
|
|
19
|
+
end
|
|
18
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
19
21
|
spec.require_paths = ["lib"]
|
|
20
22
|
|
|
21
23
|
spec.add_dependency "reform", ">= 2.3.0.rc1", "< 3.0.0"
|
|
22
24
|
spec.add_dependency "activemodel", ">= 3.2"
|
|
23
|
-
|
|
24
|
-
spec.add_development_dependency "rails"
|
|
25
|
-
spec.add_development_dependency "bundler"
|
|
26
|
-
spec.add_development_dependency "rake"
|
|
27
|
-
spec.add_development_dependency "minitest"
|
|
28
|
-
spec.add_development_dependency "actionpack"
|
|
29
|
-
spec.add_development_dependency "activerecord"
|
|
30
|
-
spec.add_development_dependency "mongoid"
|
|
31
|
-
spec.add_development_dependency "sqlite3"
|
|
32
25
|
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.0.rc3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nick Sutterer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2019-11-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: reform
|
|
@@ -44,118 +44,6 @@ dependencies:
|
|
|
44
44
|
- - ">="
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
46
|
version: '3.2'
|
|
47
|
-
- !ruby/object:Gem::Dependency
|
|
48
|
-
name: rails
|
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
|
50
|
-
requirements:
|
|
51
|
-
- - ">="
|
|
52
|
-
- !ruby/object:Gem::Version
|
|
53
|
-
version: '0'
|
|
54
|
-
type: :development
|
|
55
|
-
prerelease: false
|
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
requirements:
|
|
58
|
-
- - ">="
|
|
59
|
-
- !ruby/object:Gem::Version
|
|
60
|
-
version: '0'
|
|
61
|
-
- !ruby/object:Gem::Dependency
|
|
62
|
-
name: bundler
|
|
63
|
-
requirement: !ruby/object:Gem::Requirement
|
|
64
|
-
requirements:
|
|
65
|
-
- - ">="
|
|
66
|
-
- !ruby/object:Gem::Version
|
|
67
|
-
version: '0'
|
|
68
|
-
type: :development
|
|
69
|
-
prerelease: false
|
|
70
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
-
requirements:
|
|
72
|
-
- - ">="
|
|
73
|
-
- !ruby/object:Gem::Version
|
|
74
|
-
version: '0'
|
|
75
|
-
- !ruby/object:Gem::Dependency
|
|
76
|
-
name: rake
|
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
|
78
|
-
requirements:
|
|
79
|
-
- - ">="
|
|
80
|
-
- !ruby/object:Gem::Version
|
|
81
|
-
version: '0'
|
|
82
|
-
type: :development
|
|
83
|
-
prerelease: false
|
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
85
|
-
requirements:
|
|
86
|
-
- - ">="
|
|
87
|
-
- !ruby/object:Gem::Version
|
|
88
|
-
version: '0'
|
|
89
|
-
- !ruby/object:Gem::Dependency
|
|
90
|
-
name: minitest
|
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
|
92
|
-
requirements:
|
|
93
|
-
- - ">="
|
|
94
|
-
- !ruby/object:Gem::Version
|
|
95
|
-
version: '0'
|
|
96
|
-
type: :development
|
|
97
|
-
prerelease: false
|
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
99
|
-
requirements:
|
|
100
|
-
- - ">="
|
|
101
|
-
- !ruby/object:Gem::Version
|
|
102
|
-
version: '0'
|
|
103
|
-
- !ruby/object:Gem::Dependency
|
|
104
|
-
name: actionpack
|
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
|
106
|
-
requirements:
|
|
107
|
-
- - ">="
|
|
108
|
-
- !ruby/object:Gem::Version
|
|
109
|
-
version: '0'
|
|
110
|
-
type: :development
|
|
111
|
-
prerelease: false
|
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
113
|
-
requirements:
|
|
114
|
-
- - ">="
|
|
115
|
-
- !ruby/object:Gem::Version
|
|
116
|
-
version: '0'
|
|
117
|
-
- !ruby/object:Gem::Dependency
|
|
118
|
-
name: activerecord
|
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
|
120
|
-
requirements:
|
|
121
|
-
- - ">="
|
|
122
|
-
- !ruby/object:Gem::Version
|
|
123
|
-
version: '0'
|
|
124
|
-
type: :development
|
|
125
|
-
prerelease: false
|
|
126
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
127
|
-
requirements:
|
|
128
|
-
- - ">="
|
|
129
|
-
- !ruby/object:Gem::Version
|
|
130
|
-
version: '0'
|
|
131
|
-
- !ruby/object:Gem::Dependency
|
|
132
|
-
name: mongoid
|
|
133
|
-
requirement: !ruby/object:Gem::Requirement
|
|
134
|
-
requirements:
|
|
135
|
-
- - ">="
|
|
136
|
-
- !ruby/object:Gem::Version
|
|
137
|
-
version: '0'
|
|
138
|
-
type: :development
|
|
139
|
-
prerelease: false
|
|
140
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
141
|
-
requirements:
|
|
142
|
-
- - ">="
|
|
143
|
-
- !ruby/object:Gem::Version
|
|
144
|
-
version: '0'
|
|
145
|
-
- !ruby/object:Gem::Dependency
|
|
146
|
-
name: sqlite3
|
|
147
|
-
requirement: !ruby/object:Gem::Requirement
|
|
148
|
-
requirements:
|
|
149
|
-
- - ">="
|
|
150
|
-
- !ruby/object:Gem::Version
|
|
151
|
-
version: '0'
|
|
152
|
-
type: :development
|
|
153
|
-
prerelease: false
|
|
154
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
155
|
-
requirements:
|
|
156
|
-
- - ">="
|
|
157
|
-
- !ruby/object:Gem::Version
|
|
158
|
-
version: '0'
|
|
159
47
|
description: Automatically load and include all common Reform features for a standard
|
|
160
48
|
Rails environment.
|
|
161
49
|
email:
|
|
@@ -165,13 +53,14 @@ extensions: []
|
|
|
165
53
|
extra_rdoc_files: []
|
|
166
54
|
files:
|
|
167
55
|
- ".gitignore"
|
|
56
|
+
- ".rubocop.yml"
|
|
57
|
+
- ".rubocop_todo.yml"
|
|
168
58
|
- ".travis.yml"
|
|
169
59
|
- CHANGES.md
|
|
170
60
|
- Gemfile
|
|
171
61
|
- LICENSE.txt
|
|
172
62
|
- README.md
|
|
173
63
|
- Rakefile
|
|
174
|
-
- database.sqlite3
|
|
175
64
|
- lib/reform/active_record.rb
|
|
176
65
|
- lib/reform/form/active_model.rb
|
|
177
66
|
- lib/reform/form/active_model/form_builder_methods.rb
|
|
@@ -208,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
208
97
|
version: 1.3.1
|
|
209
98
|
requirements: []
|
|
210
99
|
rubyforge_project:
|
|
211
|
-
rubygems_version: 2.
|
|
100
|
+
rubygems_version: 2.6.14.3
|
|
212
101
|
signing_key:
|
|
213
102
|
specification_version: 4
|
|
214
103
|
summary: Automatically load and include all common Rails form features.
|
data/database.sqlite3
DELETED
|
Binary file
|