Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何更改 rails 资源路由,以便每个资源路由都附加一个需要传递的参数?然而,棘手的部分是参数需要在控制器之后但在操作之前传递。
像这样:
/posts/:type/new /posts/:type/edit
等等..
你可能想要这样的东西,你有单独的路由到同一个控制器:
namespace :posts do resources :public, controller: "posts" resources :private, controller: "posts" end
这给了你/posts/public/*和/posts/private/*。
/posts/public/*
/posts/private/*