A Teeny Tiny Plugin for working with others
April 3rd, 2009
If you work with designers or getting to grip with a new codebase you may find yourself frequently answering the question 'What template generates this bit of html'. This smidgen of code adds comments to your html with the path to the templates used. For example the template
Hello
<%= render :partial => 'some_partial' -%>
might generate
<!-- TEMPLATE: views/dummy/index.html.erb --> Hello <!-- TEMPLATE: views/dummy/_some_partial.erb --> Here is a partial <!-- ENDTEMPLATE: views/dummy/_some_partial.erb --> <!-- ENDTEMPLATE: views/dummy/index.html.erb -->
You can grab the code from github. Original idea from this thread on rails-talk
2 Responses to “A Teeny Tiny Plugin for working with others”
Sorry, comments are closed for this article.
April 4th, 2009 at 01:15 AM Oh wow. I did the same thing a while ago. But I called it "HTML-Trace" and it stopped working after Rails 2.1. Nice though.
April 4th, 2009 at 01:17 AM also, be wary of anything which may use a; <%=h render :partial => "some_partial" %> as that would obviously break.