active_dry_form 1.2.1 → 1.4.0
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 +4 -4
- data/Gemfile.lock +68 -76
- data/lib/active_dry_form/base_form.rb +11 -10
- data/lib/active_dry_form/builder.rb +2 -6
- data/lib/active_dry_form/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4bd09fb7a62c1ed888ddb3abc634ec2b510e9a3be286e3313aa6e6fc58ebea3
|
4
|
+
data.tar.gz: b7a8c47ed543b855ebf8e5baa98206a923adbc54a605d84a836aecdaee5f12c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 011c0a880ae29f2d4084817552d0cc068c769c1e6cbcb3e9691688a65b67cccaca5d48b250249f1f3e7f0618308c23c33ee78209fbcf42db94023f650b7825ad
|
7
|
+
data.tar.gz: 14e4ccba512e7aa7867b1537f4ba136d9b108519ae3fb95472b6237d77b075762a35ce4caf96ec1df583855125a01fba2b620e302429da0dd80c55f888285c6e
|
data/Gemfile.lock
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
GIT
|
2
2
|
remote: https://github.com/corp-gp/rubocop-gp.git
|
3
|
-
revision:
|
3
|
+
revision: e5bd900ce4b10077cf8f4ae88a5a6e32e7861b65
|
4
4
|
specs:
|
5
5
|
rubocop-gp (0.0.4)
|
6
6
|
rubocop
|
@@ -27,7 +27,7 @@ GIT
|
|
27
27
|
PATH
|
28
28
|
remote: .
|
29
29
|
specs:
|
30
|
-
active_dry_form (1.
|
30
|
+
active_dry_form (1.4.0)
|
31
31
|
actionpack
|
32
32
|
activerecord
|
33
33
|
dry-configurable
|
@@ -37,70 +37,64 @@ PATH
|
|
37
37
|
GEM
|
38
38
|
remote: https://rubygems.org/
|
39
39
|
specs:
|
40
|
-
actionpack (7.
|
41
|
-
actionview (= 7.
|
42
|
-
activesupport (= 7.
|
40
|
+
actionpack (7.1.3.4)
|
41
|
+
actionview (= 7.1.3.4)
|
42
|
+
activesupport (= 7.1.3.4)
|
43
43
|
nokogiri (>= 1.8.5)
|
44
44
|
racc
|
45
|
-
rack (>= 2.2.4
|
45
|
+
rack (>= 2.2.4)
|
46
46
|
rack-session (>= 1.0.1)
|
47
47
|
rack-test (>= 0.6.3)
|
48
48
|
rails-dom-testing (~> 2.2)
|
49
49
|
rails-html-sanitizer (~> 1.6)
|
50
|
-
|
51
|
-
|
52
|
-
activesupport (= 7.2.2.1)
|
50
|
+
actionview (7.1.3.4)
|
51
|
+
activesupport (= 7.1.3.4)
|
53
52
|
builder (~> 3.1)
|
54
53
|
erubi (~> 1.11)
|
55
54
|
rails-dom-testing (~> 2.2)
|
56
55
|
rails-html-sanitizer (~> 1.6)
|
57
|
-
activemodel (7.
|
58
|
-
activesupport (= 7.
|
59
|
-
activerecord (7.
|
60
|
-
activemodel (= 7.
|
61
|
-
activesupport (= 7.
|
56
|
+
activemodel (7.1.3.4)
|
57
|
+
activesupport (= 7.1.3.4)
|
58
|
+
activerecord (7.1.3.4)
|
59
|
+
activemodel (= 7.1.3.4)
|
60
|
+
activesupport (= 7.1.3.4)
|
62
61
|
timeout (>= 0.4.0)
|
63
|
-
activesupport (7.
|
62
|
+
activesupport (7.1.3.4)
|
64
63
|
base64
|
65
|
-
benchmark (>= 0.3)
|
66
64
|
bigdecimal
|
67
|
-
concurrent-ruby (~> 1.0, >= 1.
|
65
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
68
66
|
connection_pool (>= 2.2.5)
|
69
67
|
drb
|
70
68
|
i18n (>= 1.6, < 2)
|
71
|
-
logger (>= 1.4.2)
|
72
69
|
minitest (>= 5.1)
|
73
|
-
|
74
|
-
tzinfo (~> 2.0
|
70
|
+
mutex_m
|
71
|
+
tzinfo (~> 2.0)
|
75
72
|
ast (2.4.2)
|
76
73
|
base64 (0.2.0)
|
77
|
-
|
78
|
-
bigdecimal (3.1.9)
|
74
|
+
bigdecimal (3.1.8)
|
79
75
|
builder (3.3.0)
|
80
|
-
concurrent-ruby (1.3.
|
81
|
-
connection_pool (2.
|
76
|
+
concurrent-ruby (1.3.3)
|
77
|
+
connection_pool (2.4.1)
|
82
78
|
crass (1.0.6)
|
83
79
|
diff-lcs (1.5.1)
|
84
80
|
drb (2.2.1)
|
85
|
-
dry-configurable (1.
|
86
|
-
dry-core (~> 1.
|
81
|
+
dry-configurable (1.2.0)
|
82
|
+
dry-core (~> 1.0, < 2)
|
87
83
|
zeitwerk (~> 2.6)
|
88
|
-
dry-core (1.1
|
84
|
+
dry-core (1.0.1)
|
89
85
|
concurrent-ruby (~> 1.0)
|
90
|
-
logger
|
91
86
|
zeitwerk (~> 2.6)
|
92
|
-
dry-inflector (1.
|
93
|
-
dry-initializer (3.
|
94
|
-
dry-logic (1.
|
95
|
-
bigdecimal
|
87
|
+
dry-inflector (1.1.0)
|
88
|
+
dry-initializer (3.1.1)
|
89
|
+
dry-logic (1.5.0)
|
96
90
|
concurrent-ruby (~> 1.0)
|
97
|
-
dry-core (~> 1.
|
91
|
+
dry-core (~> 1.0, < 2)
|
98
92
|
zeitwerk (~> 2.6)
|
99
|
-
dry-monads (1.
|
93
|
+
dry-monads (1.6.0)
|
100
94
|
concurrent-ruby (~> 1.0)
|
101
|
-
dry-core (~> 1.
|
95
|
+
dry-core (~> 1.0, < 2)
|
102
96
|
zeitwerk (~> 2.6)
|
103
|
-
dry-types (1.
|
97
|
+
dry-types (1.7.2)
|
104
98
|
bigdecimal (~> 3.0)
|
105
99
|
concurrent-ruby (~> 1.0)
|
106
100
|
dry-core (~> 1.0)
|
@@ -113,100 +107,98 @@ GEM
|
|
113
107
|
dry-initializer (~> 3.0)
|
114
108
|
dry-schema (>= 1.12, < 2)
|
115
109
|
zeitwerk (~> 2.6)
|
116
|
-
erubi (1.13.
|
117
|
-
i18n (1.14.
|
110
|
+
erubi (1.13.0)
|
111
|
+
i18n (1.14.5)
|
118
112
|
concurrent-ruby (~> 1.0)
|
119
|
-
json (2.
|
113
|
+
json (2.7.2)
|
120
114
|
language_server-protocol (3.17.0.3)
|
121
|
-
|
122
|
-
loofah (2.24.0)
|
115
|
+
loofah (2.22.0)
|
123
116
|
crass (~> 1.0.2)
|
124
117
|
nokogiri (>= 1.12.0)
|
125
|
-
|
126
|
-
|
127
|
-
nokogiri (1.
|
128
|
-
mini_portile2 (~> 2.8.2)
|
118
|
+
minitest (5.24.1)
|
119
|
+
mutex_m (0.2.0)
|
120
|
+
nokogiri (1.16.6-arm64-darwin)
|
129
121
|
racc (~> 1.4)
|
130
|
-
nokogiri (1.
|
122
|
+
nokogiri (1.16.6-x86_64-linux)
|
131
123
|
racc (~> 1.4)
|
132
|
-
parallel (1.
|
133
|
-
parser (3.3.
|
124
|
+
parallel (1.25.1)
|
125
|
+
parser (3.3.3.0)
|
134
126
|
ast (~> 2.4.1)
|
135
127
|
racc
|
136
|
-
racc (1.8.
|
137
|
-
rack (3.1.
|
138
|
-
rack-session (2.
|
139
|
-
base64 (>= 0.1.0)
|
128
|
+
racc (1.8.0)
|
129
|
+
rack (3.1.6)
|
130
|
+
rack-session (2.0.0)
|
140
131
|
rack (>= 3.0.0)
|
141
|
-
rack-test (2.
|
132
|
+
rack-test (2.1.0)
|
142
133
|
rack (>= 1.3)
|
143
134
|
rails-dom-testing (2.2.0)
|
144
135
|
activesupport (>= 5.0.0)
|
145
136
|
minitest
|
146
137
|
nokogiri (>= 1.6)
|
147
|
-
rails-html-sanitizer (1.6.
|
138
|
+
rails-html-sanitizer (1.6.0)
|
148
139
|
loofah (~> 2.21)
|
149
|
-
nokogiri (
|
140
|
+
nokogiri (~> 1.14)
|
150
141
|
rainbow (3.1.1)
|
151
142
|
rake (13.2.1)
|
152
|
-
regexp_parser (2.
|
143
|
+
regexp_parser (2.9.2)
|
144
|
+
rexml (3.3.1)
|
145
|
+
strscan
|
153
146
|
rspec (3.13.0)
|
154
147
|
rspec-core (~> 3.13.0)
|
155
148
|
rspec-expectations (~> 3.13.0)
|
156
149
|
rspec-mocks (~> 3.13.0)
|
157
|
-
rspec-core (3.13.
|
150
|
+
rspec-core (3.13.0)
|
158
151
|
rspec-support (~> 3.13.0)
|
159
|
-
rspec-expectations (3.13.
|
152
|
+
rspec-expectations (3.13.1)
|
160
153
|
diff-lcs (>= 1.2.0, < 2.0)
|
161
154
|
rspec-support (~> 3.13.0)
|
162
|
-
rspec-mocks (3.13.
|
155
|
+
rspec-mocks (3.13.1)
|
163
156
|
diff-lcs (>= 1.2.0, < 2.0)
|
164
157
|
rspec-support (~> 3.13.0)
|
165
|
-
rspec-support (3.13.
|
166
|
-
rubocop (1.
|
158
|
+
rspec-support (3.13.1)
|
159
|
+
rubocop (1.64.1)
|
167
160
|
json (~> 2.3)
|
168
161
|
language_server-protocol (>= 3.17.0)
|
169
162
|
parallel (~> 1.10)
|
170
163
|
parser (>= 3.3.0.2)
|
171
164
|
rainbow (>= 2.2.2, < 4.0)
|
172
|
-
regexp_parser (>=
|
173
|
-
|
165
|
+
regexp_parser (>= 1.8, < 3.0)
|
166
|
+
rexml (>= 3.2.5, < 4.0)
|
167
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
174
168
|
ruby-progressbar (~> 1.7)
|
175
|
-
unicode-display_width (>= 2.4.0, <
|
176
|
-
rubocop-ast (1.
|
169
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
170
|
+
rubocop-ast (1.31.3)
|
177
171
|
parser (>= 3.3.1.0)
|
178
172
|
rubocop-capybara (2.21.0)
|
179
173
|
rubocop (~> 1.41)
|
180
174
|
rubocop-factory_bot (2.26.1)
|
181
175
|
rubocop (~> 1.61)
|
182
|
-
rubocop-performance (1.
|
176
|
+
rubocop-performance (1.21.1)
|
183
177
|
rubocop (>= 1.48.1, < 2.0)
|
184
178
|
rubocop-ast (>= 1.31.1, < 2.0)
|
185
|
-
rubocop-rails (2.
|
179
|
+
rubocop-rails (2.25.1)
|
186
180
|
activesupport (>= 4.2.0)
|
187
181
|
rack (>= 1.1)
|
188
|
-
rubocop (>= 1.
|
182
|
+
rubocop (>= 1.33.0, < 2.0)
|
189
183
|
rubocop-ast (>= 1.31.1, < 2.0)
|
190
|
-
rubocop-rspec (3.
|
184
|
+
rubocop-rspec (3.0.2)
|
191
185
|
rubocop (~> 1.61)
|
192
186
|
rubocop-rspec_rails (2.30.0)
|
193
187
|
rubocop (~> 1.61)
|
194
188
|
rubocop-rspec (~> 3, >= 3.0.1)
|
195
189
|
ruby-progressbar (1.13.0)
|
196
|
-
securerandom (0.4.1)
|
197
190
|
sqlite3 (1.7.3-arm64-darwin)
|
198
191
|
sqlite3 (1.7.3-x86_64-linux)
|
199
|
-
|
192
|
+
strscan (3.1.0)
|
193
|
+
timeout (0.4.1)
|
200
194
|
tzinfo (2.0.6)
|
201
195
|
concurrent-ruby (~> 1.0)
|
202
|
-
unicode-display_width (
|
203
|
-
|
204
|
-
unicode-emoji (4.0.4)
|
205
|
-
useragent (0.16.11)
|
206
|
-
zeitwerk (2.6.18)
|
196
|
+
unicode-display_width (2.5.0)
|
197
|
+
zeitwerk (2.6.16)
|
207
198
|
|
208
199
|
PLATFORMS
|
209
200
|
arm64-darwin-21
|
201
|
+
arm64-darwin-24
|
210
202
|
x86_64-linux
|
211
203
|
|
212
204
|
DEPENDENCIES
|
@@ -48,6 +48,10 @@ module ActiveDryForm
|
|
48
48
|
attrs.each do |attr, v|
|
49
49
|
next if !ActiveDryForm.config.strict_param_keys && !respond_to?(:"#{attr}=")
|
50
50
|
|
51
|
+
# Params for nested forms comes as a hash from frontend, convert them to array
|
52
|
+
# { '0' => { url: 'https://omniplatform.ru' }, '1' => { url: 'https://google.com' } } => [{ ... }, { ... }]
|
53
|
+
v = v.values if v.is_a?(Hash) && self.class::NESTED_FORM_ARRAYS.include?(attr.to_sym)
|
54
|
+
|
51
55
|
public_send(:"#{attr}=", v)
|
52
56
|
end
|
53
57
|
end
|
@@ -98,19 +102,12 @@ module ActiveDryForm
|
|
98
102
|
self
|
99
103
|
end
|
100
104
|
|
101
|
-
|
102
|
-
key = id
|
103
|
-
[key] if key
|
104
|
-
end
|
105
|
-
|
106
|
-
# hidden field for nested association
|
107
|
-
def id
|
108
|
-
record&.id
|
109
|
-
end
|
105
|
+
delegate :to_key, :id, to: :record, allow_nil: true
|
110
106
|
|
111
107
|
# используется при генерации URL, когда record.persisted?
|
112
108
|
def to_param
|
113
|
-
|
109
|
+
# подмодель может быть Hash, например сохраняется в json атрибут
|
110
|
+
record.is_a?(Hash) ? '' : record.to_param
|
114
111
|
end
|
115
112
|
|
116
113
|
def validate
|
@@ -150,6 +147,7 @@ module ActiveDryForm
|
|
150
147
|
|
151
148
|
def self.define_methods
|
152
149
|
const_set :NESTED_FORM_KEYS, []
|
150
|
+
const_set :NESTED_FORM_ARRAYS, Set.new
|
153
151
|
|
154
152
|
self::FIELDS_INFO[:properties].each do |key, value|
|
155
153
|
define_method :"#{key}=" do |v|
|
@@ -175,6 +173,9 @@ module ActiveDryForm
|
|
175
173
|
namespace: key,
|
176
174
|
is_array: value[:type] == 'array',
|
177
175
|
}
|
176
|
+
if value[:type] == 'array'
|
177
|
+
self::NESTED_FORM_ARRAYS << key.to_sym
|
178
|
+
end
|
178
179
|
nested_key = key
|
179
180
|
end
|
180
181
|
|
@@ -81,13 +81,9 @@ module ActiveDryForm
|
|
81
81
|
if association.is_a?(BaseForm)
|
82
82
|
fields_for_nested_model("#{@object_name}[#{association_name}]", association, fields_options, block)
|
83
83
|
elsif association.respond_to?(:to_ary)
|
84
|
-
|
85
|
-
|
86
|
-
Array.wrap(association).each do |child|
|
87
|
-
output << fields_for_nested_model("#{@object_name}[#{association_name}][]", child, fields_options, block)
|
88
|
-
.gsub(field_name_regexp, "#{@object_name}[#{association_name}][]").html_safe
|
84
|
+
Array.wrap(association).each_with_index.reduce(ActiveSupport::SafeBuffer.new) do |output, (child, i)|
|
85
|
+
output << fields_for_nested_model("#{@object_name}[#{association_name}][#{i}]", child, fields_options, block)
|
89
86
|
end
|
90
|
-
output
|
91
87
|
end
|
92
88
|
end
|
93
89
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_dry_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ermolaev Andrey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
|
-
rubygems_version: 3.3.
|
134
|
+
rubygems_version: 3.3.7
|
135
135
|
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: Form validation for Rails with Dry-Validation
|