Rails: install Administrate

Gems Link to heading

Add these to your Gemfile:

# Administration
gem 'administrate', '~> 0.20.0'

# Authentication
gem 'devise', '~> 4.9', '>= 4.9.3'

Then install your new gems:

bundle install

Generate Link to heading

bundle exec rails generate devise:install
bundle exec rails generate devise SystemOperator
bundle exec rails generate administrate:install --namespace=operations
bundle exec rails generate administrate:dashboard SystemOperator --namespace=operations

Changes Link to heading

  devise_for :system_operators

  namespace :operations do
    resources :system_operators, only: %i[index show new create edit update destroy]

    root to: 'system_operators#index'
  end

NOTE: use the PLURAL form of words:

resourceSSSSSSSSSSSSSSSSSSSSSS :system_operatorSSSSSSSSSSSSSSSSSSSS

Generate Link to heading

Now you can generate new models:

bundle exec rails g model Organisation name:string slug:string --migration

Run migrations:

bundle exec rails db:migrate

Then generate the dashboard:

bundle exec rails generate administrate:dashboard Organisation --namespace=operations

Tweaking Link to heading

You can rollback your migration to edit, then gneerate models again:

bundle exec rails db:rollback STEP=1