弃用警告:ActionView::Template::Handlers::Erubis 已弃用,将从 Rails 5.2 中删除

DEPRECATION WARNING: ActionView::Template::Handlers::Erubis is deprecated and will be removed from Rails 5.2

DEPRECATION WARNING: ActionView::Template::Handlers::Erubis is deprecated and will be removed from Rails 5.2. Switch to ActionView::Template::Handlers::ERB::Erubi instead.

警告清楚地解释为切换到 ActionView::Template::Handlers::ERB::Erubi。 好的 但是如何 我所做的是将 gem 'haml-rails' 替换为 'haml' 但仍然警告

它发生在 Rails 5.1.0 rc1 和 Ruby 2.4.1

下一个发布的 Haml 版本 (5.0.0) 应该会消除此警告:https://github.com/haml/haml/blob/9cc8b13e0b2c383f1a3000d9069d3fedc4377d2d/CHANGELOG.md

  • Support Rails 5.1 Erubi template handler.

我报告为错误。 现在已修复 here

扩展的@Sergio 回答。要删除警告,您需要:

 bundle update haml-rails

如果您遇到一些依赖性错误,请在您的 Gemfile 文件中删除 'version guard' for haml-rails

  gem 'haml-rails' # add version guard just after update