# Print name of partial

**URL:** <https://www.ruby-forum.com/t/print-name-of-partial/105498>\
**Category:** Rails\
**Created:** [May 30, 2007, 2:49pm UTC](https://www.ruby-forum.com/t/print-name-of-partial/105498 "2007-05-30T14:49:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![khmckgrp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ac8455/32.png) [@khmckgrp](https://www.ruby-forum.com/u/khmckgrp)\
**Post date:** [May 30, 2007, 2:49pm UTC](https://www.ruby-forum.com/t/print-name-of-partial/105498/1 "2007-05-30T14:49:06Z")

</div>

DRY works, but when applied to partials it does make debugging someone  
else code more difficult!

Is there a way to add a debug line (in each \_file.rhtml) that would  
print out the name of the partials that comprise a page? This would be a  
BIG help in drilling down into a page to identify exactly which view is  
responsible for each part of a page.

---

<div class="post-metadata">

**Author:** ![khmckgrp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ac8455/32.png) [@khmckgrp](https://www.ruby-forum.com/u/khmckgrp)\
**Post date:** [May 30, 2007, 3:57pm UTC](https://www.ruby-forum.com/t/print-name-of-partial/105498/2 "2007-05-30T15:57:07Z")

</div>

On Wed, May 30, 2007 at 02:49:06PM +0200, Kevin Hankinson wrote:

> DRY works, but when applied to partials it does make debugging someone  
> else code more difficult!
> 
> Is there a way to add a debug line (in each \_file.rhtml) that would  
> print out the name of the partials that comprise a page? This would be a  
> BIG help in drilling down into a page to identify exactly which view is  
> responsible for each part of a page.

You’ll have to do some digging in the Rails source, but you can monkey  
patch something into the render method.

–Greg

---

<div class="post-metadata">

**Author:** ![khmckgrp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ac8455/32.png) [@khmckgrp](https://www.ruby-forum.com/u/khmckgrp)\
**Post date:** [May 30, 2007, 4:35pm UTC](https://www.ruby-forum.com/t/print-name-of-partial/105498/3 "2007-05-30T16:35:14Z")

</div>

Kevin,

> Is there a way to add a debug line (in each \_file.rhtml) that would  
> print out the name of the partials that comprise a page?

The annotate\_renders plugin does just that :

[http://agilewebdevelopment.com/plugins/annotate\_renders](http://agilewebdevelopment.com/plugins/annotate_renders)  
[http://svn.livsey.org/plugins/annotate\_renders/](http://svn.livsey.org/plugins/annotate_renders/)

## Alain R.

[http://blog.ravet.com](http://blog.ravet.com)

---

<div class="post-metadata">

**Author:** ![khmckgrp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ac8455/32.png) [@khmckgrp](https://www.ruby-forum.com/u/khmckgrp)\
**Post date:** [May 30, 2007, 4:45pm UTC](https://www.ruby-forum.com/t/print-name-of-partial/105498/4 "2007-05-30T16:45:09Z")

</div>

Thank You Alain, just what I was looking for. I am sure many others will  
find this useful.
