我是 ROR 的新手,我在整理文件时遇到了麻烦。
我正在使用设计,我有两个模型:管理员和用户。此外,我为这两个范围生成了设计视图。
当前,我有一个名为 admin 的文件夹,在创建 admins 文件夹后,我的文件有些混乱。
当前文件结构
controllers
├── admin
| ├── dashboard_controller.rb
| └── reports_controller.rb
|
└── admins
└── registrations_controller.rb (custom controller inherit from devise controllers)
views
├── admin
| ├── dashboard
| | ├───── new.html.erb
| | └───── edit.html.erb
| └── reports
| ├────── new.html.erb
| └────── edit.html.erb
|
└── admins
├── registrations
├── sessions
└ ...
我的路线
devise_for :admins, path: 'admin', path_names: { sign_in: 'login', sign_out: 'logout'}
authenticate :admin do
namespace :admin do
resources :dashboard, only:[:index]
end
end
在这种情况下,组织文件的最佳方法是什么?有什么材料可以推荐给我吗?