nested_form_fields 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +0 -4
- data/lib/nested_form_fields.rb +9 -15
- data/lib/nested_form_fields/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
data/lib/nested_form_fields.rb
CHANGED
@@ -41,27 +41,21 @@ module ActionView::Helpers
|
|
41
41
|
association = convert_to_model(association)
|
42
42
|
|
43
43
|
if association.respond_to?(:persisted?)
|
44
|
-
association = [association]
|
44
|
+
association = [association]
|
45
45
|
elsif !association.respond_to?(:to_ary)
|
46
46
|
association = @object.send(association_name)
|
47
47
|
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
fields_for_nested_model("#{name}[#{explicit_child_index || nested_child_index(name)}]", child, options, block)
|
55
|
-
end
|
49
|
+
explicit_child_index = options[:child_index]
|
50
|
+
output = ActiveSupport::SafeBuffer.new
|
51
|
+
association.each do |child|
|
52
|
+
output << nested_fields_wrapper(association_name) do
|
53
|
+
fields_for_nested_model("#{name}[#{explicit_child_index || nested_child_index(name)}]", child, options, block)
|
56
54
|
end
|
57
|
-
|
58
|
-
templates = nested_model_template(name, association_name, options, block)
|
59
|
-
output << templates
|
60
|
-
|
61
|
-
output
|
62
|
-
elsif association
|
63
|
-
fields_for_nested_model(name, association, options, block)
|
64
55
|
end
|
56
|
+
|
57
|
+
output << nested_model_template(name, association_name, options, block)
|
58
|
+
output
|
65
59
|
end
|
66
60
|
|
67
61
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nested_form_fields
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-22 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! "Rails gem for dynamically adding and removing nested has_many association
|
15
15
|
fields in a form.\n Uses jQuery and supports multiple nesting
|