0

The following errors appears when I try to run rails console in production. (In development mode it works as expected)

bin$ RAILS_ENV=production ./rails c
/home/ubuntu/app/shared/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:509:in `load_missing_constant': Circular dependency detected while autoloading constant AdminUser (RuntimeError)

My AdminUser contains the following:

 class AdminUser < ApplicationRecord
  devise :database_authenticatable, 
         :recoverable, :rememberable, :trackable, :validatable
end
Ayrad
  • 3,996
  • 8
  • 45
  • 86
  • https://stackoverflow.com/questions/25460756/circular-dependency-detected-while-autoloading-constant-when-loading-constant – rock Sep 28 '20 at 13:49

2 Answers2

0

It'll be more helpful if you can post code for AdminUser

check your code (AdminUser) for circular references like

1: callback triggering the same callback (update self after update)
2: method calling the same method

esantos
  • 142
  • 1
  • 4
  • My AdminUser doesn't have much it extends ApplicationRecord and contains the devise settings. I'm editing the question with the contents of the file – Ayrad Sep 28 '20 at 08:33
0

Pluralizing all the controllers under /admin fixed this issue

https://github.com/activeadmin/activeadmin/issues/2334#issuecomment-42626409

Ayrad
  • 3,996
  • 8
  • 45
  • 86