2015-05-06 49 views
1

我使用设计,因此不需要用户控制器。但是,我也需要嵌套的路线和我的config.routes看起来像这样;未初始化的恒定UsersController

devise_for :admin_users, ActiveAdmin::Devise.config 
    ActiveAdmin.routes(self) 
    devise_for :users 

    resources :users do 
    resources :personal_accounts,path: "user_account", only: [:show] do 
     resources :deposits, only: [:new, :show, :create, :index] 
     resources :withdraws, only: [:new, :show, :create, :index] 
    end 
    resources :businesses do 
     resources :business_accounts, path: "business_account", only: [:show] do 
     resources :business_withdraws, only: [:new, :show, :create, :index] 
     resources :business_deposits, only: [:new, :show, :create, :index] 
     end 
    end 
    end 

我怎样才能通过这个错误,同时也维护我的嵌套路线。 谢谢。

回答

1

您有三层嵌套的路线那里,这通常被认为是不可取的:http://edgeguides.rubyonrails.org/routing.html#nested-resources

资源不应该被嵌套超过10级深。

这位resources :users do将创建用户控制器的所有命名路由,我怀疑这是您的错误来自何处。你为什么需要这个?或许更好地指定没有它的路线?

resources :personal_accounts,path: "user_account", only: [:show] do 
    resources :deposits, only: [:new, :show, :create, :index] 
    resources :withdraws, only: [:new, :show, :create, :index] 
end 
相关问题