title: Rails collection route to delete many records at once
body: <p>I created a collection route for remove_multiple:</p>
  
  <pre><code>resources :myfiles do
    collection do
      delete 'remove_multiple' =&gt; 'myfiles#remove_multiple'
    end
  end
  </code></pre>
  
  <p>Here's my view:</p>
  
  <pre><code>&lt;%= form_tag remove_multiple_myfiles_path, method: :delete do %&gt;
  &lt;table&gt;
  .....
  &lt;td&gt;&lt;%= check_box_tag "myfile_ids[]", myfile.id %&gt;&lt;/td&gt;
  .....
  &lt;/table&gt;
  &lt;%= submit_tag "Delete all" %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>And here's my controller:</p>
  
  <p><code>before_action :set_myfile, :check_user, except: [:remove_multiple]</code></p>
  
  <pre><code>def remove_multiple
   @myfiles = Myfile.find(params[:myfile_ids])
   @myfiles.each do |myfile|
    myfile.destroy
   end
   flash[:notice] = "Deleted files!"
   redirect_to trashcan_path
  end
  </code></pre>
  
  <p>But here's what the console says:</p>
  
  <pre><code>Started DELETE "/myfiles/remove_multiple" for ::1 at 2015-01-20     14:16:02 +0530
  Processing by MyfilesController#destroy as HTML
  Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"VebaegOfVddyLiOs9oWP4DcLReC7ZPyttpKulIWMOMZN1JJ18T07aMirTSsqWkiDZOL8yMZ1iYi093tk4Qx4KQ==", "myfile_ids"=&gt;["55", "56", "57"], "commit"=&gt;"Delete all", "id"=&gt;"remove_multiple"}
  Myfile Load (0.3ms)  SELECT  `myfiles`.* FROM `myfiles` WHERE `myfiles`.`id` = 0 LIMIT 1
  Redirected to http://localhost:3000/
  Filter chain halted as :set_myfile rendered or redirected
  Completed 302 Found in 5ms (ActiveRecord: 0.3ms)
  </code></pre>
  
  <p>Why is it executing Myfiles#destroy method? Even when I specify the route?</p>