1

所以我在lib目录中有一个文件。在该文件的顶部,我包含以下内容:

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

每当我包含该要求时,我都会收到以下错误消息:

Circular dependency detected while autoloading constant AdminUser (RuntimeError)

在上下文中:

/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)>'

有任何想法吗?

编辑:

这是由以下生成的 AdminUser 类的定义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
4

1 回答 1

2

这可能不是直接的activeadmin问题。由于调用unloadable. 因此,这可能来自您可能正在使用的其他宝石。

参考:

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(见丹的最后评论)

于 2013-11-12T18:01:19.873 回答