How to deal with vendor/plugins after upgrading to rails 3.2.1

后端 未结 4 839
故里飘歌
故里飘歌 2021-01-31 03:50

After upgrading to rails3.2.1,this warning occurs:

You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them

4条回答
  •  情歌与酒
    2021-01-31 04:18

    No one has mentioned converting to a Railtie or Rails::Engine.

    Just move all of your ruby files into a gem [use bundle gem to create it for minimal friction].

    Then have a look at the Railtie docs [and find your target Rails version]:

    https://apidock.com/rails/v3.2.13/Rails/Railtie

    It's quite easy to just convert an old plugin init.rb to a railtie in this way, and it gives you a pathway to Rails 4+.

    Got views or controllers?, then use a Rails::Engine instead. While engines in gems can be complicated from a workflow standpoint, converting a plugin to one is pretty trivial.

    Do yourself a favor and start building tests right in the gem, instead of in the Rails project.

提交回复
热议问题