title: How to route the same url to different actions?
body: <p>I have a page that I'm rendering through the index action of a controller. I want to add a link to this page, which will reload the current page, but I want it to route to a different action first.</p>
  
  <p>Here's what my routes.rb file looks like:</p>
  
  <pre><code>match 'users/:id/food' =&gt; 'foods#index', :as =&gt; :foods_show
  match 'users/:id/food' =&gt; 'foods#sell', :as =&gt; :food_sell
  </code></pre>
  
  <p>And my link_to:</p>
  
  <pre><code>&lt;%= link_to "Sell this Food", food_sell_path(current_user.id) %&gt;
  </code></pre>
  
  <p>So the page is normally rendered via foods#index, but when a User clicks on this link, I want to reload the current page but via a different action than index.</p>
  
  <p>Controller code:</p>
  
  <pre><code>def index
      @user = User.find(params[:id])
      @food = @user.foods
  end
  
  def sell
      @user = User.find(params[:id])
      @food = @user.foods
      redirect_to foods_show_path(@user.id), :notice =&gt; "You have sold one item!"
  end
  </code></pre>
  
  <p>Thanks!</p>