如何使用文件夹连接rails 3中的路线



我收到一个错误没有匹配[GET]的路由,因为试图为某些控制器创建文件夹

这里的应用程序结构:

|controller,helper,view|
 |user_management| ------> FOLDER
   |user|          ------> SUBFOLDER  
   |login|         ------> SUBFOLDER    
   |chat|          ------> SUBFOLDER  
 |sale_management| ------> FOLDER  
   |sale|          ------> SUBFOLDER  
   |product|       ------> SUBFOLDER  

此处控制器:

 # UserManagement Controllers
 class UserManagement::UserController < ApplicationController
 class UserManagement::LoginController < ApplicationController
 class UserManagement::ChatController < ApplicationController
 # SaleManagement Controllers
 class SaleManagement::SaleController < ApplicationController
 class SaleManagement::ProductController < ApplicationController

这里的助手:

 module UserManagement::UserHelper
 module UserManagement::LoginHelper
 module UserManagement::ChatHelper
 module SaleManagement::SaleHelper
 module SaleManagement::ProductHelper

Router.rb从rails 2.3和ruby 1.8

map.root :controller => "user_management/user", :action=>"index"
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'

我正在从rails 3和ruby 1.9执行Routes.rb,但出现路由错误

root :to => 'user_management/user#index'
match ':controller(/:action(/:id))(.:format)'

有人能帮我吗?

以下是示例

scope module: 'user_management' do
   scope module: 'user' do
      resources :users
   end
end

然后您可以访问users,如localhost:3000/users

有关更多详细信息,请查看轨道路由

最新更新