我为“帖子”设置了脚手架,并想使用 ActiveAdmin 来编辑和创建新的。
在我的 routes.rb 文件中,我有这样的帖子设置:
resources :posts
我希望当有人去 '/posts/new' 时被重定向到 '/admin/posts/new' 与编辑相同的事情。从“/posts/:id/edit”到“/admin/posts/:id/edit”
如何在更改新路线和编辑路线时保持其他路线不变?
编辑
这是我的“耙子路线”
tags GET /tags(.:format) tags#index
POST /tags(.:format) tags#create
new_tag GET /tags/new(.:format) tags#new
edit_tag GET /tags/:id/edit(.:format) tags#edit
tag GET /tags/:id(.:format) tags#show
PUT /tags/:id(.:format) tags#update
DELETE /tags/:id(.:format) tags#destroy
admin_root /admin(.:format) admin/dashboard#index
batch_action_admin_admin_users POST /admin/admin_users/batch_action(.:format) admin/admin_users#batch_action
admin_admin_users GET /admin/admin_users(.:format) admin/admin_users#index
POST /admin/admin_users(.:format) admin/admin_users#create
new_admin_admin_user GET /admin/admin_users/new(.:format) admin/admin_users#new
edit_admin_admin_user GET /admin/admin_users/:id/edit(.:format) admin/admin_users#edit
admin_admin_user GET /admin/admin_users/:id(.:format) admin/admin_users#show
PUT /admin/admin_users/:id(.:format) admin/admin_users#update
DELETE /admin/admin_users/:id(.:format) admin/admin_users#destroy
admin_dashboard /admin/dashboard(.:format) admin/dashboard#index
batch_action_admin_posts POST /admin/posts/batch_action(.:format) admin/posts#batch_action
admin_posts GET /admin/posts(.:format) admin/posts#index
POST /admin/posts(.:format) admin/posts#create
new_admin_post GET /admin/posts/new(.:format) admin/posts#new
edit_admin_post GET /admin/posts/:id/edit(.:format) admin/posts#edit
admin_post GET /admin/posts/:id(.:format) admin/posts#show
PUT /admin/posts/:id(.:format) admin/posts#update
DELETE /admin/posts/:id(.:format) admin/posts#destroy
batch_action_admin_tags POST /admin/tags/batch_action(.:format) admin/tags#batch_action
admin_tags GET /admin/tags(.:format) admin/tags#index
POST /admin/tags(.:format) admin/tags#create
new_admin_tag GET /admin/tags/new(.:format) admin/tags#new
edit_admin_tag GET /admin/tags/:id/edit(.:format) admin/tags#edit
admin_tag GET /admin/tags/:id(.:format) admin/tags#show
PUT /admin/tags/:id(.:format) admin/tags#update
DELETE /admin/tags/:id(.:format) admin/tags#destroy
batch_action_admin_comments POST /admin/comments/batch_action(.:format) admin/comments#batch_action
admin_comments GET /admin/comments(.:format) admin/comments#index
POST /admin/comments(.:format) admin/comments#create
admin_comment GET /admin/comments/:id(.:format) admin/comments#show
new_admin_user_session GET /admin/login(.:format) active_admin/devise/sessions#new
admin_user_session POST /admin/login(.:format) active_admin/devise/sessions#create
destroy_admin_user_session DELETE|GET /admin/logout(.:format) active_admin/devise/sessions#destroy
admin_user_password POST /admin/password(.:format) active_admin/devise/passwords#create
new_admin_user_password GET /admin/password/new(.:format) active_admin/devise/passwords#new
edit_admin_user_password GET /admin/password/edit(.:format) active_admin/devise/passwords#edit
PUT /admin/password(.:format) active_admin/devise/passwords#update
posts GET /posts(.:format) posts#index
POST /posts(.:format) posts#create
new_post GET /posts/new(.:format) posts#new
edit_post GET /posts/:id/edit(.:format) posts#edit
post GET /posts/:id(.:format) posts#show
PUT /posts/:id(.:format) posts#update
DELETE /posts/:id(.:format) posts#destroy
root / posts#index