2015-05-06 51 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 
相關問題