Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How create an admistrate dashboard with a moduled model
  1. If our model is Faq::UserType, then we generates the dashboard with:

rails generate administrate:dashboard faq/user_type

This generates:

Running via Spring preloader in process 21074
      create  app/dashboards/user_type_dashboard.rb
      create  app/controllers/admin/user_types_controller.rb
  1. Make the module folder inside controllers and dashboard:
mkdir app/controllers/admin/faq/
mkdir app/dashboards/faq/
  1. Move the administrate controller to module folder:
mv app/controllers/admin/user_types_controller.rb app/controllers/admin/faq/
  1. Move the dashboard to module folder:
mv app/dashboards/user_type_dashboard.rb app/dashboards/faq/
  1. Add namespace to routes:
namespace :admin do
  namespace :faq do
    resources :user_types
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment