title: Rails destroy js.erb
body: <p>Can you tell me please, how I could remove object before destroy method will be end. When I use next pattern, removing object happen when photo was delete, but it take 1 or 3 or more seconds. </p>
  
  <p>_form(edit action)</p>
  
  <pre><code>&lt;% listing.photos.each do |photo|%&gt;
      &lt;%= image_tag photo.image.thumb, class: 'thumbnail', id: "test"%&gt;
      &lt;%= link_to "remove", photo_path(photo),class: 'btn btn-primary', method: :delete, data: { confirm: 'Are you sure?' }, remote: true %&gt;
  </code></pre>
  
  <p>destroy.js.erb</p>
  
  <pre><code>$('#test').remove();
  </code></pre>
  
  <p>How I can use this pattern</p>
  
  <p>_form:</p>
  
  <pre><code>&lt;div id="test_&lt;%= photo.id %&gt;"&gt;
    &lt;%= image_tag photo.image.thumb, class: 'thumbnail'%&gt;
    &lt;%= link_to "remove", photo_path(photo),class: 'btn btn-primary', method: :delete, data: { confirm: 'Are you sure?' }, remote: true %&gt;
  </code></pre>
  
  <p>Destroy.js.erb:</p>
  
  <pre><code> $('#edit_image_&lt;%= @photo.id %&gt;').remove();
  </code></pre>