If you read the Rails source, you will see
In ActiveSupport Autoload, click
The following code was found:
def self.extended(base)#:nodoc: base.class_evaldo @_autoloads={} @_under_path=nil @_at_path=nil @_eager_autoload=false end endfor the class when extended
I'm defining class instance variables.
Why do I not use class variables?
Unlike class instance variables,
For class variables,
because the inheritance destination can reference the parent variable.
I think it will work the same way as the above code.
Self-resolved.
When extending, class variables cannot be referenced in the inheritance destination, so
Failed to define class instance variable for inheritance destination in self.extended.
© 2024 OneMinuteCode. All rights reserved.