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

前端 未结 5 1923
感动是毒
感动是毒 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条回答
  •  天涯浪人
    2021-02-08 00:45

    environment.rb

    config.to_prepare do
      User.send :include, Qwerty::Core::Extensions::User
    end
    

    The code is the block is run before every request in development mode and once in production mode.

提交回复
热议问题