[英]about rails' routes, adding collection routes to restful resources won't generate named route helpers?
namespace :admin do
resources :posts do
collection do
get 'whatever'
end
end
end
我期望它將生成“ whatever_admin_posts_path”幫助程序方法,但沒有。
我的代碼有問題嗎? 還是Rails中的錯誤?
通常不將名稱空間添加到返回路由的方法中。 因此,您可能有一條路線whatever_posts_path
。 耙任務rake routes
在這些情況下特別有用。 每個路線的顯示內容的第一部分是可用於訪問它的方法的名稱(如果有)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.