ruby-on-rails 未初始化的常量InheritedResources::Base(NameError)

8wtpewkr  于 2023-05-08  发布在  Ruby
关注(0)|答案(1)|浏览(214)

当我将rails的版本从6.0.4升级到7.0.1时,我也升级了一些依赖项的gem。之后,当我启动Rails服务器时,一个错误弹出

1: from /home/developer/.rvm/gems/ruby-2.7.7/gems/activeadmin-2.12.0/lib/active_admin/base_controller/authorization.rb:2:in `<main>' /home/developer/.rvm/gems/ruby-2.7.7/gems/activeadmin-2.12.0/lib/active_admin/base_controller/authorization.rb:3:in `\<module:ActiveAdmin\>': uninitialized constant InheritedResources::Base (NameError)

我在gemfile中做了一些修改

管理员

gem "font-awesome-rails"
gem "coffee-rails"
gem 'rails_admin', '\~\> 3.0.0'
gem 'activeadmin'#, '\~\> 2.12.0'
gem 'active_admin_role', '\~\> 0.2.1'
gem 'responsive_active_admin', '\~\> 0.0.6'
gem 'activeadmin_addons'
gem 'pundit'
gem 'sassc-rails'
gem 'inherited_resources', '\~\> 1.11'
k5ifujac

k5ifujac1#

我在这里找到了解决办法。https://github.com/activeadmin/activeadmin/issues/7196
单位:config/initializers/active_admin_extensions.rb
改变这个

ActiveAdmin::BaseController.send(:include, ActiveAdmin::CustomActions)

ActiveSupport.on_load(:active_admin_controller) do
  ActiveAdmin::BaseController.include ActiveAdmin::CustomActions
end

PS:你的文件名可以不一样

相关问题