所以我在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