【问题标题】:`require': cannot load such file -- cancan (LoadError)`require': 无法加载此类文件 -- cancan (LoadError)
【发布时间】:2013-09-04 00:46:08
【问题描述】:

我将 CanCan gem 与 A​​ctiveAdmin 一起使用。它在开发中按预期工作,但是当推送到登台服务器时,我收到以下错误:

`require': cannot load such file -- cancan (LoadError)

就我而言,这是由 ActiveAdmin 的 CanCan 适配器中的 the 'require' line 引起的。

我已经在 Google 上搜索过可能的解释,但都一无所获。

可能是什么原因导致此类错误,我该如何解决?

更新:

这是我的config/initializers/active_admin.rb

ActiveAdmin.setup do |config|
  config.authentication_method = :authenticate_user!
  config.authorization_adapter = ActiveAdmin::CanCanAdapter
  config.cancan_ability_class = "Ability"
  config.current_user_method = :current_user
  config.logout_link_path = :destroy_user_session_path
  config.allow_comments = false
  config.batch_actions = true
end

【问题讨论】:

  • 发布您的 gemfile。如果您在暂存环境中从 rails 控制台运行“$> require 'cancan'”会发生什么?
  • 从 Rails 控制台运行require 'cancan' 的结果是=> false。 Gemfile 中的相关行是gem 'cancan'gem 'activeadmin', '0.6.0', github: "gregbell/active_admin"
  • 发布您的 activeadmin 初始化文件
  • 您是否在暂存环境中运行了bundle install
  • @Vimsha 是的,通过 Capistrano。上面提到的require 'cancan' 的成功也说明bundle 安装正确。 @Nicolas 已发布。

标签: ruby-on-rails ruby ruby-on-rails-3 activeadmin cancan


【解决方案1】:

重新启动整个机器修复了这个问题。

我曾尝试重新启动 nginx 和 unicorn,但我还没有重新启动机器本身。无论出于何种原因,这都成功了。

感谢您的想法/建议。

【讨论】:

    猜你喜欢
    • 2014-05-27
    • 2017-03-27
    • 1970-01-01
    • 2022-09-26
    • 1970-01-01
    • 2020-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多