$("#<%= dom_id @user %>").remove(); <% if !@not_approved_count.nil? %> <% if @not_approved_count > 0 %> $("#registration_count").text("(<%= @not_approved_count %>)"); <% else %> $("#registration_count").remove(); <% end %> <% end %>