| Module | NestedForm::BuilderMixin |
| In: |
lib/nested_form/builder_mixin.rb
|
Adds a link to insert a new associated records. The first argument is the name of the link, the second is the name of the association.
f.link_to_add("Add Task", :tasks)
You can pass HTML options in a hash at the end and a block for the content.
<%= f.link_to_add(:tasks, :class => "add_task", :href => new_task_path) do %>
Add Task
<% end %>
You can also pass model_object option with an object for use in the blueprint, e.g.:
<%= f.link_to_add(:tasks, :model_object => Task.new(:name => 'Task')) %>
See the README for more details on where to call this method.
Adds a link to remove the associated record. The first argment is the name of the link.
f.link_to_remove("Remove Task")
You can pass HTML options in a hash at the end and a block for the content.
<%= f.link_to_remove(:class => "remove_task", :href => "#") do %>
Remove Task
<% end %>
See the README for more details on where to call this method.