title: Ruby on Rails: rosource RESOURCE_NAME dosent generate index route/action
body: <p>im currently trying to use the resource but one problem im having , that when i do the following </p>
  
  <pre><code>resource :orders
  </code></pre>
  
  <p>the route <strong>/orders</strong> dosent route to <strong>OrdersController#index</strong> rather it points to the <strong>show</strong> action of the controller, how can i fix this issue ?</p>
  
  <p><a href="https://i.stack.imgur.com/neCpD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/neCpD.png" alt="this is the routes that are generated"></a></p>
  
  <p>becuase of this problem im having to do this which i feel is kinda hack and not good </p>
  
  <pre class="lang-rb prettyprint-override"><code>  get '/orders', to: 'orders#index'
    get '/orders/:id', to: 'orders#show'
  </code></pre>
  
  <p>this is my <code>routes.rb</code> file</p>
  
  <pre class="lang-rb prettyprint-override"><code>Rails.application.routes.draw do
    get '/carts', to: 'carts#index'
  
    get '/payments', to: 'payments#index'
    post '/payments', to: 'payments#add_credits'
  
    get '/orders', to: 'orders#index'
    get '/orders/:id', to: 'orders#show'
  
    resources :users do
      resource :orders, only: %i[show create index]
      resource :carts, only: %i[create destroy], path: 'cart', as: 'cart'
    end
  
    resource :sessions, only: [] do
      post 'login', action: :create
      post 'logout', action: :destroy
      get 'login', action: :new
    end
    resources :products
    # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
  end
  
  </code></pre>
  
  <p>thanks for your answer :)</p>