Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPedro Henrique Knoll Giacometo
6,669 PointsFile organization - Devise Admin and Admin namespace
I'm a pretty new to ROR and i'm in trouble to organize my files.
I'm using Devise and I have two models: Admin and User. Also, I generated the Devise views for the both scopes.
Current I have a folder called admin and my files got a little confused after I created the admins folder.
Current files structure
controllers
├── admin
| ├── dashboard_controller.rb
| └── reports_controller.rb
|
└── admins
└── registrations_controller.rb (custom controller inherit from devise controllers)
views
├── admin
| ├── dashboard
| | └───── index.html.erb
| |
| └── reports
| ├────── new.html.erb
| └────── edit.html.erb
|
└── admins
├── registrations
├── sessions
└ ...
My routes
devise_for :admins, path: 'admin', path_names: { sign_in: 'login', sign_out: 'logout'}
authenticate :admin do
namespace :admin do
resources :dashboard, only:[:index]
resources :reports
end
end
In this case, what is the best approach to organize the files? Any materials to recommend me?