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

前端 未结 5 1918
感动是毒
感动是毒 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
    闹比i (楼主)
    2021-02-08 00:50

    Slightly more elegant solution than the one accepted since it can be put in an initializer:

    require 'dispatcher'
    
    Dispatcher.to_prepare do
      # stuff that needs to happen once per initialization
    end
    

提交回复
热议问题