I'm really confused because some of my routes when I use controllername_index_url
are routing to /controllername/index
while other's are routing to /controllername
.
The main difference is that when I generate the index method when I create the controller through the command line
rails g controller controllerName1 index
the route then becomes /controller_name_1/index
.
When I create the index manually after creating the controller, it becomes /controllername2
In my config/routes I am including my controllers like:
Rails.application.routes.draw do
resources :controller_name_1
resources :controller_name_2
end
And when I do a rails routes
my routes look like
controller_name_1_index GET /controller_name_1/index(.:format) controlle_name_1#index
controller_name_2_index GET /controller_name_2(.:format) controller_name_2#index
Why is it automatically adding the routes differently? How can I make it so that regardless of it I generate the index methods on the command line or add them in after the fact, controller_name_index_url
routes are always the same format? (I'm using ruby 2.4.0 and rails 5.1.2 if that's helpful)