質問

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