File organization - Two models

12 views
Skip to first unread message

Pedro Henrique Knoll Giacometo

unread,
Nov 29, 2016, 3:10:51 PM11/29/16
to Devise
Hello,

I'm a pretty new to ROR and i'm in trouble to organize my files.

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
    |     |      ├──── new.html.erb
    |     |      ─── edit.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]
    end
  end

In this case, what is the best approach to organize the files? Any materials to recommend me?
Reply all
Reply to author
Forward
0 new messages