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

后端 未结 4 925
故里飘歌
故里飘歌 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:29

    both the other answers are good and seem to work.

    However if your plugin consists of a single .rb file under vendor/plugins/.../lib and the vendor/plugins/.../init.rb is just a

    require 'pluginname'
    

    Then you can simply copy the single file to your lib directory and add a file to config/initializers that does a require 'yourpluginname'

    Here is a concrete example using the acts_as_rated plugin which is not a gem yet.

    1. copy vendor/plugins/acts_as_rated/lib/acts_as_rated.rb to lib/

    2. create a file config/initializers/acts_as_rated.rb with the following...

      require 'acts_as_rated'

    3. delete vendor/plugins/acts_as_rated

提交回复
热议问题