I’m trying to work out if there is a way to customise the HTML inserted by link_to_add when using the nested_form/simple_form gems in Rails 3.
At the moment it generates a div, but I would like it to generate a table row.
I have seen an example of using the Cocoon gem but using nested_form would be my preference.
The current code is pretty straight forward:
table.table.table-striped
tr
th Name
th Notes
th $ Value
th
= f.simple_fields_for :client_contracted_rates do |ccr|
tr
td = ccr.text_field :name, :class => "span2"
td = ccr.text_field :notes, :class => "span2"
td = ccr.text_field :value, :class => "span1"
td = ccr.link_to_remove "x", :class => "btn btn-mini btn-danger"
= f.link_to_add "+ Add Contracted Rate", :client_contracted_rates, :class => "btn pull-right"
I’m hoping to generate a table row, or at least something different to the div and input defaults.
Cheers,
Jono
I ended up not using the f.link_to_add and just used a = link_to approach instead.
This allowed me to wrap the = link_to inside the table row as needed.