2

Trying to install Administrator Gem in a ruby app Follow all the steps and when trying to open the app having this issue in my terminal :

"NameError (uninitialized constant Admin::Administrate):"

CONTROLLERS > ADMIN

module Admin
  class ApplicationController < Administrate::ApplicationController
    before_action :authenticate_admin

    def authenticate_admin
      # TODO Add authentication logic here.
    end

Some routes generated:

Rails.application.routes.draw do
  namespace :admin do
    resources :coaches
    resources :coach_profiles
    resources :sessions

    root to: 'coaches#index'
  end

I desinstalled the gem and reinstalled it. not working

ALT90
  • 21
  • 1
  • I don't see any issue in your code. have you tried `rails g administrate:install` command to install it. – Kamal Panhwar May 18 '21 at 01:55
  • move your `ApplicationController` out of Admin module (as well as admin folder) or you also can create your custom controller which extend `ApplicationController` inside module `Administrate` (also administrate folder - the way gem administrate organize modules) – Lam Phan May 18 '21 at 05:58
  • This looks like the gem is not loaded. Administrate makes the module `Administrate` available immediately. Is it in the Gemfile? How are you running Rails? Do you have the same problem with other gems? Do you have a `require` that might be loading things in an unexpected order? – pablobm May 20 '21 at 08:07

1 Answers1

0

Your code looks fine, try restarting your server

ochi
  • 131
  • 1
  • 3