title: Rails: link_to calls custom method in controller
body: <p>I am looking to use <code>link_to</code> to call a method in my controller. However, for some odd reason the route looks for the <code>show</code> method. </p>
  
  <p>In my view:</p>
  
  <pre><code>&lt;% @beverages.each do |beverage| %&gt;
      ..
      &lt;%= link_to 'Archive', beverages_archive_path(:id =&gt; beverage.id) %&gt;
      ..
  &lt;% end %&gt;
  </code></pre>
  
  <p>In my config/routes.rb</p>
  
  <pre><code>match 'beverages/archive' =&gt; 'beverages#archive'
  </code></pre>
  
  <p>In my beverages_controller.rb</p>
  
  <pre><code>  def archive
      beverage = Beverage.find(params[:id])
  
      respond_to do |format|
      #  format.html # show.html.erb
        format.json { render json: beverage }
      end
      # beverage.update_attribute('archive', true)
    end
  </code></pre>
  
  <p>When I click on the archive link in the view, the URL does change to: <code>http://localhost:3000/beverages/archive?id=11</code>, however I get the following error.</p>
  
  <p><strong>The error I get:</strong>
  <img src="https://i.stack.imgur.com/Ja2xb.png" alt="error">
  ActiveRecord::RecordNotFound (Couldn't find Beverage with id=archive):
    app/controllers/beverages_controller.rb:46:in `show'</p>
  
  <p>Any idea on what I am doing wrong? Your help is much appreciated!</p>
  
  <p>PS. I also looked at <a href="https://stackoverflow.com/questions/9203827/rails-3-link-to-delete-destory-method-calls-show-method">Rails 3 link_to delete destory method calls show method?</a>
  but nothing seemed to work.</p>