Rails 3.1. Cocoon link_to_add_association example needed

Posted by BazZy on Stack Overflow See other posts from Stack Overflow or by BazZy
Published on 2011-09-24T10:46:27Z Indexed on 2012/10/26 23:01 UTC
Read the original article Hit count: 314

Filed under:
|
|

pls show any example of using Cocoon's 'link_to_add_association' with html_options. https://github.com/nathanvda/cocoon

Documentation says:

html_options: extra html-options (see link_to) There are two extra options that allow to conrol the placement of the new link-data:

    data-association-insertion-node : the jquery selector of the node
    data-association-insertion-position : insert the new data before or after the given node.

But i can not understand what to do, if i want insert partial just before my "add element" link. Not just after parent's div begin. This not gonna work:

<%= link_to_add_association "add element", f, :production_years, :position => "after_all" %>

© Stack Overflow or respective owner

Related posts about ruby-on-rails-3

Related posts about forms