title: No route matches [POST] error Ruby on Rails
body: <p>I want to trigger a method via button but I have a little rounting issue. </p>
  
  <p>Here is my view code : </p>
  
  <pre><code>   &lt;% @orders.each do |order| %&gt;
       &lt;% if order.confirm == true %&gt;
       &lt;tr class="confirmed"&gt;
         &lt;% else %&gt;
       &lt;tr class="not_confirmed"&gt;
       &lt;% end %&gt; 
         &lt;td&gt;&lt;%= order.name %&gt;&lt;/td&gt;
         &lt;td&gt;&lt;%= order.address %&gt;&lt;/td&gt;
         &lt;td&gt;&lt;%= order.email %&gt;&lt;/td&gt;
         &lt;td&gt;&lt;%= order.pay_type %&gt;&lt;/td&gt;
         &lt;td&gt;&lt;%= link_to 'Show', order %&gt;&lt;/td&gt;
         &lt;td&gt;&lt;%= link_to 'Edit', edit_order_path(order) %&gt;&lt;/td&gt;
         &lt;td&gt;&lt;%= button_to "Confirm payment", :controller =&gt; :orders, :action =&gt; :confirm  %&gt;&lt;/td&gt;
  </code></pre>
  
  <p>Here is method definition from controller : </p>
  
  <pre><code>def confirm
      @order = Order.find(params[:id])
      @order.confirm = true
  end
  </code></pre>
  
  <p>And here from routes.rb:</p>
  
  <pre><code>resources :orders do
      put :confirm, :on =&gt; :collection
  end
  </code></pre>
  
  <p>When i press button i got <strong>No route matches [POST] "/orders/confirm"</strong> error</p>
  
  <p>In addition i paste screen from rake:routes</p>
  
  <p><img src="https://i.stack.imgur.com/K8355.png" alt="enter image description here"></p>