![](/img/trans.png)
[英]Rails 5 install error (DEPRECATION WARNING: alias_method_chain is deprecated)
[英]DEPRECATION WARNING: alias_method_chain is deprecated
我将项目升级到 Rails 5。当我运行rspec
我收到一条警告
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead.
From module, you can access the original method using super.
(called from <top (required)> at /home/alex/projects/myproject/config/application.rb:13)
application.rb 中的失败行是:
Bundler.require(*Rails.groups)
如何找出导致此弃用警告的原因以及如何消除错误?
在 OSX 中,您可以使用:
grep -Ir alias_method_chain `bundle show rails`/..
这将列出所有使用alias_method_chain
的 gem
如果 Gemfile 太大,我建议使用the_silver_searcher来搜索已弃用的 alias_method_chain,因为它更快
ag alias_method_chain /path/to/gemset
我有gepgems
bash 辅助函数,每次都不会输入 /path/to/gemset
grepgems alias_method_chain
要使用它,请将以下函数添加到您的 .bash_profile(或您喜欢的点文件中的其他位置)
function grepgems() {
ag $1 $GEM_HOME"/gems"
}
码头工人的解决方案:
docker exec -it [CONTAINER_NAME] /bin/bash
apt-get install silversearcher-ag
ag alias_method_chain $GEM_HOME"/gems"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.