Rendering the partials and templates paths on top of them as HTML comments

The idea is to make a little bit easier to find the rendered partials and templates when you start working in an existing project, I know we can see the log but I want something easier, in the log you don’t know how the partial looks like only the name. Right now I’m doing this:

In https://github.com/rails/rails/blob/master/actionpack/lib/action_view/renderer/partial_renderer.rb#L308 I add this:

 content = layout.render(view, locals){ content } if layout

 content.insert(0, "<!-- Partial Rendered: #{@path} -->\n") # <<<<

content

And I get this:

http://d.pr/i/Og9X

but I’m looking for a better way to do it, and the main goal is to submit a patch if people think it’s worth it or maybe a little gem, don’t know, I’d like to have a config option in config/development.rb like this too:

config.action_view.render_template_paths = true

Of course, this is only useful to me in development mode.

Any ideas?

Hm overriding #render in PartialRenderer looks just right to me.

PartialRenderer.class_eval do
def render(*)
super + " Partial rendered… "
end
end

Does that work?