Leo Net
Leo Net

Reputation: 797

Cocoon Gem Add Item Programmatically

I'm trying to add an item with the Cocoon gem programmatically. I used this:

$("a.add_fields").click();

And it does work. I'm wondering if there is a more elegant solution. This seems a bit like a hack.

Upvotes: 2

Views: 141

Answers (1)

nathanvda
nathanvda

Reputation: 50057

No. At the moment that is the only way. The code would have to be refactored for this to work, and all configuration is in the link anyway (which association, which partial, how to build, ...), so I think it is not too bad at the moment.

Upvotes: 2

Related Questions