formwandler 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/formwandler/form.rb +7 -1
- data/lib/formwandler/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a27068466663a6f025c030ea940bcba509ecb09
|
4
|
+
data.tar.gz: 78089c958ca21790a7538f6d85e3c25762ff8fb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a4e3b0b19310c31aa8dc71099dabda8e128e7042271753c4d1d835aadb764fa4afe455ab4b0c7adc53a9750e5654b0aa18cd9c703f38fc8bc8d94302c7e87e4
|
7
|
+
data.tar.gz: 1eeddda4bc9f432351c4ebeab0ce50fea589cc9c200d2d941e3b6be54bd7c56ca83ad387414b8b2a6592c84eb9a3c8e46ce2b863ea7d362e1eedefcbea4a8262
|
data/lib/formwandler/form.rb
CHANGED
@@ -135,10 +135,16 @@ module Formwandler
|
|
135
135
|
|
136
136
|
def permitted_params
|
137
137
|
visible_fields = fields.reject(&:hidden?).map(&:name)
|
138
|
-
delocalizations = fields.map(&:delocalize).compact
|
139
138
|
controller.params.require(model_name.param_key).permit(*visible_fields).delocalize(delocalizations)
|
140
139
|
end
|
141
140
|
|
141
|
+
def delocalizations
|
142
|
+
fields.reduce({}) do |memo, field|
|
143
|
+
memo[field.name] = field.delocalize
|
144
|
+
memo
|
145
|
+
end.compact
|
146
|
+
end
|
147
|
+
|
142
148
|
def initialize_fields
|
143
149
|
@fields = self.class.field_definitions.transform_values do |field_definition|
|
144
150
|
Field.new(form: self, field_definition: field_definition)
|
data/lib/formwandler/version.rb
CHANGED