我的控制器
account
-profiles_controller.rb
我的观看次数
account
-profiles
--index.html.haml
我的路线
namespace :account do
resources :profiles
end
当前以此url的形式工作。 http://localhost:3000/account/profiles
但我希望这样。 http://localhost:3000/profiles
我该怎么办?
答案 0 :(得分:1)
使用scope
代替namespace
scope module: "account" do
resources :profiles
end
OR
您也可以将其写为
resources :profiles, module: "account"
有关更多信息,请参见controller-namespaces-and-routing