ruby-on-railsrubyactiveadminrails-engines

ActiveAdmin in rails engine give me that error : uninitialized constant MyEngine::Admin


I installed activeadmin in a rails engine that I mounted in my main application. When I try to access the home page I get the following error: uninitialized constant BackOffice::Admin

The code in lib/back_office/engine.rb

require 'devise'
require 'activeadmin'

module BackOffice
  class Engine < ::Rails::Engine
    isolate_namespace BackOffice

    initializer :back_office do
      ActiveAdmin.application.load_paths += Dir[File.dirname(__FILE__) + '/back_office/admin']
    end
  end
end

routes.rb

BackOffice::Engine.routes.draw do
  devise_for :admin_users, class_name: "BackOffice::AdminUser"
  ActiveAdmin.routes(self)
end

In the routes.rb file of my main app I have this :

mount BackOffice::Engine, at: "/back_office"

Can someone help please?


Solution

  • I managed to solve the error then got another one and so on. I solved all issues by creating my engine with the full option and not the mountable one.