<%= javascript_tag do %>
var id = "#edit_<%= dom_id(product) %>";
var inputs = $(id).parent().find('input');
$(id).parent().find('button').on('click', function(e) {
e.preventDefault();
$(id).append(inputs.clone());
$(id).append('');
$(id).submit();
});
<% end %>
<% end %>