You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can then generate a nested form using the nested_form_for helper method.
28
30
29
31
<%= nested_form_for @project do |f| %>
30
32
31
-
Use this form just like normal, including the fields_for helper method for nesting models. The benefit of this plugin comes from the link_to_add and link_to_remove helper methods on the form builder.
33
+
Use this form just like normal, including the +fields_for+ helper method for nesting models. The benefit of this plugin comes from the +link_to_add+ and +link_to_remove+ helper methods on the form builder.
32
34
33
35
<%= f.fields_for :tasks do |task_form| %>
34
36
<%= task_form.text_field :name %>
@@ -38,6 +40,7 @@ Use this form just like normal, including the fields_for helper method for nesti
38
40
39
41
This generates links which dynamically add and remove fields.
40
42
43
+
41
44
== Partials
42
45
43
46
It is often desirable to move the nested fields into a partial to keep things organized. If you don't supply a block to fields_for it will look for a partial and use that.
@@ -46,7 +49,9 @@ It is often desirable to move the nested fields into a partial to keep things or
46
49
47
50
In this case it will look for a partial called "task_fields" and pass the form builder as an f variable to it.
48
51
52
+
49
53
== Special Thanks
50
54
51
-
This gem is based on the plugin by Ryan Bates: http://github.com/ryanb/nested_form
55
+
This gem was originally based on the solution by Tim Riley in his {complex-form-examples fork}[https://github.com/timriley/complex-form-examples/tree/unobtrusive-jquery-deep-fix2].
52
56
57
+
Thank you Andrew Manshin for the Rails 3 transition, {Andrea Singh}[https://github.com/madebydna] for converting to a gem and {Peter Giacomo Lombardo}[https://github.com/pglombardo] for Prototype support.
0 commit comments