Skip to content

Instantly share code, notes, and snippets.

@lcguida
Created February 22, 2022 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lcguida/e6f839273300797d2fa4c89f8109cc5b to your computer and use it in GitHub Desktop.
Save lcguida/e6f839273300797d2fa4c89f8109cc5b to your computer and use it in GitHub Desktop.
Debug rails autoloading
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