0
我嘗試使用具有名稱空間的引擎路由。 我的應用程序的routes.rb文件:我可以在routes.rb中使用不同名稱空間兩次安裝Rails引擎嗎?
Rails.application.routes.draw do
namespace :admin, admin_scope: true do
mount Notifications::Engine, at: '/notifications'
end
namespace :user, user_scope: true do
mount Notifications::Engine, at: '/notifications'
end
end
我的引擎的routes.rb文件:
Notifications::Engine.routes.draw do
get 'messages' => 'messages#index', as: 'messages'
end
我因子評分
user_notifications.messages_path
將打印/用戶/通知/消息和
admin_notifications.messages_path
wi將打印/管理員/通知/消息。但是
admin_notifications.messages_path
給我相同的/ user/notifications/messages路徑。
爲什麼? Thanx。
但第二底座覆蓋了第一次。 admin_admin_notifications.messages_path和user_user_notifications.messages_path都給出/ user/notifications/messages。 – user5503258