Chris@1295: var fileSpan = $('#attachments_<%= j params[:attachment_id] %>'); Chris@1295: $('', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan); Chris@1295: fileSpan.find('a.remove-upload') Chris@1295: .attr({ Chris@1295: "data-remote": true, Chris@1295: "data-method": 'delete', Chris@1295: href: '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>' Chris@1295: }) Chris@1295: .off('click');