【问题标题】:Why do I get deprecation warnings about Rails 2.3-style plugins?为什么我会收到有关 Rails 2.3 样式插件的弃用警告?
【发布时间】:2026-01-14 18:40:01
【问题描述】:

我有一个带有 /javascript 和 /plugins 的供应商目录/directgor​​y,但它们是空的,所以我也删除了它们。

我做了 git add --all 并推送了删除,但我仍然收到警告消息:

       DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /tmp/build_97dea2eb
-3f5c-4dc6-9455-2f0aa0cab7de/Rakefile:7)
       DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /tmp/build_97dea2eb
-3f5c-4dc6-9455-2f0aa0cab7de/Rakefile:7)
       DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /tmp/build_97dea2eb
-3f5c-4dc6-9455-2f0aa0cab7de/Rakefile:7)
       DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move the
m out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes 
for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /tmp/build_97dea2eb
-3f5c-4dc6-9455-2f0aa0cab7de/Rakefile:7)

【问题讨论】:

    标签: ruby-on-rails heroku plugins asset-pipeline deprecation-warning


    【解决方案1】:

    如果您使用的是 Rails 3,那么 Heroku 在部署时会将插件注入您的代码 - 您可以通过添加来防止这种情况发生

    gem rails_12factor 
    

    到您的 gemfile、捆绑、提交和重新推送。这是记录在here

    【讨论】:

      【解决方案2】:

      是什么

      git ls-files vendor/*
      

      显示?如果它在那里显示文件,那么你仍然有文件在那里。

      【讨论】:

        最近更新 更多