Created
February 22, 2022 21:45
-
-
Save lcguida/e6f839273300797d2fa4c89f8109cc5b to your computer and use it in GitHub Desktop.
Debug rails autoloading
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Rails | |
class Application | |
alias_method :old_eager_load, :eager_load! | |
def eager_load! | |
puts "Eager Loading from Rails::Application" | |
old_eager_load | |
end | |
end | |
end | |
module Rails | |
class Engine | |
alias_method :another_eager_load, :eager_load! | |
def eager_load! | |
puts "Eager Loading from #{self.class.name}" | |
another_eager_load | |
end | |
end | |
end | |
module ActiveSupport | |
module Dependencies | |
module ModuleConstMissing | |
alias_method :old_const_missing, :const_missing | |
def const_missing(name) | |
puts "Trying to find constant #{name}" | |
old_const_missing(name) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment