![](/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.