$('.<%=plural_linking_resource_name%>_form').html("#{j render 'admin/<%=plural_linking_resource_name%>/form', :<%=plural_child_name%> => @<%=plural_child_name%>, :<%=resource_name%> => @<%=resource_name%>}"); $("#<%=linking_resource_name%>_"+"#{@<%=linking_resource_name%>.id}").remove(); $(".chosen_select").chosen();