1

So I have a file in the lib directory. At the top of that file, I include the following:

require File.expand_path('../../config/environment', __FILE__)

Whenever I include that require, I get the following error message:

Circular dependency detected while autoloading constant AdminUser (RuntimeError)

In context:

/Users/ahcarpenter/.rvm/gems/ruby-1.9.3-p448@global/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:461:in `load_missing_constant': Circular dependency detected while autoloading constant AdminUser (RuntimeError)
    from /Users/ahcarpenter/.rvm/gems/ruby-1.9.3-p448@global/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:184:in `const_missing'
    from /Users/ahcarpenter/Dropbox/workspace/Web Applications/main-site/app/admin/admin_user.rb:1:in `<top (required)>'

Any ideas?

EDIT:

Here's the definition of the AdminUser class as generated by activeadmin:

ActiveAdmin.register AdminUser do
  index do
    column :email
    column :current_sign_in_at
    column :last_sign_in_at
    column :sign_in_count
    default_actions
  end

  filter :email

  form do |f|
    f.inputs "Admin Details" do
      f.input :email
      f.input :password
      f.input :password_confirmation
    end
    f.actions
  end
  controller do
    def permitted_params
      params.permit admin_user: [:email, :password, :password_confirmation]
    end
  end
end
Drew
  • 2,583
  • 5
  • 36
  • 54
  • Can you give some more context of the problem. Whats the definition of `AdminUser` class? – Nerve Nov 12 '13 at 17:38
  • Also, I guess the actual definition of the AdminUser class is in `activeadmin` library? – Drew Nov 12 '13 at 17:45
  • Alright, so, I wound up just changing the name of `admin_user.rb` to `admin_user1.rb`. However, it does seem like a v hacky fix and I'm not sure at this point as to whether it will break `activeadmin` – Drew Nov 12 '13 at 17:51
  • 1
    It might not be an activeadmin issue at all.. See https://github.com/flyerhzm/switch_user/issues/34 – Nerve Nov 12 '13 at 17:57

1 Answers1

2

This might not be an activeadmin issue directly. Several gems broke in some versions of rails 4(Circular dependency issue) due to call to unloadable. So, this might be from some other gem you might be using.

References:

https://github.com/flyerhzm/switch_user/issues/34

https://github.com/thoughtbot/high_voltage/issues/68

https://github.com/websocket-rails/websocket-rails/issues/101 (See last comment by Dan)

Nerve
  • 6,463
  • 4
  • 29
  • 29
  • This link might be further useful. http://stackoverflow.com/questions/17561697/argumenterror-a-copy-of-applicationcontroller-has-been-removed-from-the-module – Nerve Nov 12 '13 at 18:05