title: How to add parameter to rails index action/method?
body: <p>I want to pass a parameter to the index action, but the I'm only getting the show action.</p>
  
  <p>routes.rb:</p>
  
  <pre><code>Test1::Application.routes.draw do
    resources :blog
  end
  </code></pre>
  
  <p>blog_controller.rb:</p>
  
  <pre><code>  def show
      # code
    end
  
    def index
      # code
    end
  </code></pre>
  
  <p>View url that send to show action instead to index action:</p>
  
  <pre><code>&lt;a  href="/blog/myvar"&gt;  My link &lt;/a&gt;
  </code></pre>
  
  <p>What should I add in routes file or in view?</p>
  
  <p>Output of my routes:</p>
  
  <pre><code>$ rake routes
  
  blog GET    /blog(.:format)          {:action=&gt;"index", :controller=&gt;"blog"}
  
  blog GET    /blog/:id(.:format)      {:action=&gt;"show", :controller=&gt;"blog"}
  </code></pre>