<% if @targets.all?(&:destroyed?) %> $('tr[id=date-<%= @effective_from %>]').nextUntil('tr.date').addBack().remove(); <% end %>