How to extend a class from an initializer and have it reload in development environment?

前端 未结 5 1930
感动是毒
感动是毒 2021-02-08 00:03

I am extending a class (which is in a plugin) by including a module, this is done in an initializer.

require \'qwerty/core/user\'
User.send :include, Qwerty::Co         


        
5条回答
  •  猫巷女王i
    2021-02-08 00:24

    Why do you use initializers to include functionality?

    Try the following instead:

    require 'qwerty/core/user'
    class User < ActiveRecord::Base
      include Qwerty::Core::Extensions::User
      # bla bla
    end
    

提交回复
热议问题