还没有找到任何可行的解决方案来解决这个问题。我正在使用 monologue gem 将基本的博客功能添加到我的应用程序中,但是我真的很想重命名 gem 提供的默认 '/monologue' 路由。
gem中封装的引擎路由如下:
Monologue::Engine.routes.draw do
root to: "posts#index"
get "/page/:page", to: "posts#index", as: "posts_page"
get "/feed" => "posts#feed", as: "feed", defaults: {format: :rss}
get "/tags/:tag" =>"tags#show", as: "tags_page"
namespace :admin, path: "monologue" do
get "/" => "posts#index", as: "" # responds to admin_url and admin_path
get "/page/:page", to: "posts#index", as: "posts_page"
get "logout" => "sessions#destroy"
get "login" => "sessions#new"
resources :sessions
resources :posts
resources :users
get "comments" => "comments#show", as: "comments"
match "/post/preview"=>"posts#preview", :as=>"post_preview", :via => [:put, :post]
end
get "*post_url" => "posts#show", as: "post"
end
在我的应用程序的 routes.rb 中,我试图重新路由它,并在前面加上类似这样的东西,但它似乎没有在 rails 注册。
Monologue::Engine.routes.prepend do
namespace :admin, path: "create" do
.......
end
end