<% content = capture do fields_for("#{params[:form_name]}[context_attributes][#{Time.now.to_i}]", @context) do |child| context_field_item(child.object, child) end end %> jQuery('#context_list').trigger("context:added", ["<%= escape_javascript(content.html_safe) %>", "<%= @context.class.name.underscore %>"]);