[英]`require': cannot load such file — cancan (LoadError)
I'm using the CanCan gem with ActiveAdmin. 我正在将CanCan gem与ActiveAdmin一起使用。 It is working as expected in dev, but when pushed to a staging server I get the following error:
它按开发人员的预期运行,但是当推送到登台服务器时,出现以下错误:
`require': cannot load such file -- cancan (LoadError)
In my case, this is caused by the 'require' line in ActiveAdmin's CanCan adapter. 就我而言,这是由ActiveAdmin的CanCan适配器中的“ require”行引起的。
I've searched Google for potential explanations but have come up empty-handed. 我已经在Google上搜索了可能的解释,但是空手而归。
What might be the cause of such an error, and how can I go about fixing it? 这种错误可能是什么原因造成的,我该如何解决呢?
Update: 更新:
Here is my config/initializers/active_admin.rb
: 这是我的
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
Restarting the entire machine fixed this. 重新启动整个计算机可以解决此问题。
I had tried restarting both nginx and unicorn, but I had yet to restart the machine itself. 我曾尝试重新启动nginx和unicorn,但尚未重新启动计算机本身。 For whatever reason, this did the trick.
无论出于何种原因,这都是成功的秘诀。
Thanks for your thoughts / suggestions. 感谢您的想法/建议。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.