Domanda

handy_network_tools is my controller

search_camera is my action in the controller

I want to write the routes file in nested way.

  resources :handy_network_tools do
    collection do
      get :search_camera
    end
  end

I prefer handy_network_tools_search_camera rather than search_camera_handy_network_tools

Any ideas ?

search_camera_handy_network_tools GET    /handy_network_tools/search_camera(.:format)          handy_network_tools#search_camera
È stato utile?

Soluzione

Route helpers are automatically defined from child to parent. If you want to change the name of the route method, you can set it explicitly using as.

resources :handy_network_tools do
  collection do
    get :search_camera, as: :handy_network_tools_search_camera
  end
end
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top