如何使用文件夹连接 rails 3 中的路由?
How can connect routes in rails 3 using folders?
我收到错误消息没有路由匹配 [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,但得到了 ROUTES ERROR
root :to => 'user_management/user#index'
match ':controller(/:action(/:id))(.:format)'
有人能帮帮我吗?
这是例子
scope module: 'user_management' do
scope module: 'user' do
resources :users
end
end
然后你可以像 localhost:3000/users
一样访问 users
更多详情检查Rails Routing
我收到错误消息没有路由匹配 [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,但得到了 ROUTES ERROR
root :to => 'user_management/user#index'
match ':controller(/:action(/:id))(.:format)'
有人能帮帮我吗?
这是例子
scope module: 'user_management' do
scope module: 'user' do
resources :users
end
end
然后你可以像 localhost:3000/users
一样访问users
更多详情检查Rails Routing