Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
## View Hierarchy
Web::Views::Home::AnotherSubclass < Web::Views::Home::WithPartial
## Add some debug code
# in view/rendering/registry.rb
def initialize(*args)
puts "Creating registry #{object_id} for #{args}"
def resolve(context)
puts "resolving with #{object_id} (#{self.class})"
view, template = @registry.fetch(format(context)) { @registry[DEFAULT_FORMAT] }, context)
# in view/rendering/layout_registry.rb
def resolve(context)
puts "resolving with #{object_id} (#{self.class})"
@registry.fetch(format(context)) { }
# start the server
ruby-2.2.0 partial-test$ RACK_ENV=development puma --threads 4:4 --port 2300 --preload --quiet
Puma starting in single mode...
* Version 2.14.0 (ruby 2.2.0-p0), codename: Fuchsia Friday
* Min threads: 4, max threads: 4
* Environment: development
Creating registry 70346904596500 for [Web::Views::Home::WithPartial]
* Listening on tcp://
Use Ctrl-C to stop
# make the request to subclass view and observe lines added to the console where server was started
Creating registry 70346905675720 for [Web::Views::Home::AnotherSubclass]
resolving with 70346905675720 (Lotus::View::Rendering::Registry)
resolving with 70346918282200 (Lotus::View::Rendering::LayoutRegistry)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.