문제

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
도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top