$('#prescription_place').replaceWith('<%= escape_javascript(render(:partial => "show")) %>'); $('.prescription').removeClass('active'); $('#prescriptions').replaceWith('<%= escape_javascript(render(:partial => "prescriptions")) %>'); $('#prescription_<%= @prescription.id %>').addClass('active');