title: rails route: same url with different id parameter
body: <ul>
  <li>ruby 2.0.0p247</li>
  <li>Rails 4.0.0</li>
  </ul>
  
  <p>Is it possible the same url contain different id parameters?</p>
  
  <p>Let me explain with more detail. I desire these relative paths:</p>
  
  <ul>
  <li>recipes/vegetarian (recipes/:kind_id)</li>
  <li>recipes/drinks (receitas/:category_id)</li>
  </ul>
  
  <p>"kind" and "category" are two different models with own ID and same relationship with "recipe".</p>
  
  <p>I have the association:</p>
  
  <p><strong>recipe.rb</strong></p>
  
  <pre><code>belongs_to :kind
  belongs_to :category
  </code></pre>
  
  <p><strong>routes.rb</strong></p>
  
  <pre><code>resources :recipes, :only =&gt; "index" do
      collection do
          get :kind, :to =&gt; "recipes#index", :path =&gt; ":kind_id"
          get :category, :to =&gt; "recipes#index", :path =&gt; ":category_id"
      end
  end
  </code></pre>
  
  <p><strong>rake routes</strong></p>
  
  <pre><code>kind_recipes GET    /receitas/:kind_id(.:format)     recipes#index
  category_recipes GET    /receitas/:category_id(.:format) recipes#index
  </code></pre>
  
  <p><strong>recipes#index</strong></p>
  
  <pre><code>if params[:kind_id]
      @kind = Kind.find_by_slug(params[:kind_id])
      @recipes = @kind.recipes
  
  elsif params[:category_id]
      @category = Category.find_by_slug(params[:category_id])
      @recipes = @category.recipes
  end
  </code></pre>
  
  <p>When I access "recipes/drinks" (drinks is a "category_id") the passed parameter is "kind_id" because the route order.</p>
  
  <p>What am I missing?</p>