A simple example.
class Base def self.inherited(child) p 'Base.inherited' end end class User < Base p 'User' end
It gives me
"Base.inherited" "User"
This works fine, but how can I fix the inherited base class binding?
Say I want my result to be
"Base.inherited" "Something inherited" "User"
and so far my User class inherits the base.
Any ideas, workarounds?
Thanks!
Updating the question will be more specific.
I need to run some code exactly when the User class inherits the database without changing the User class.
Say I have a base class with a specific inherited method. For one thing, I donβt know which other classes inherit Base. On the other hand, I cannot change the original inherited method of the base class.
So how can I fix this method?
Thanks!
source share