lundi 11 janvier 2016

How can connect routes in rails 3 using folders?

I'm getting an error No route matches [GET] because trying to create folders per certain controllers

Here the app structure:

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

Here controllers:

 # UserManagement Controllers
 class UserManagement::UserController < ApplicationController
 class UserManagement::LoginController < ApplicationController
 class UserManagement::ChatController < ApplicationController

 # SaleManagement Controllers
 class SaleManagement::SaleController < ApplicationController
 class SaleManagement::ProductController < ApplicationController

Here helpers:

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

Router.rb from rails 2.3 and ruby 1.8

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

I'm doing Routes.rb from rails 3 and ruby 1.9 but got ROUTES ERROR

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

Please somebody can help me?

Aucun commentaire:

Enregistrer un commentaire