# How to determine if you are in a partial?

**URL:** <https://www.ruby-forum.com/t/how-to-determine-if-you-are-in-a-partial/92284>\
**Category:** Rails\
**Created:** [April 17, 2007, 8:31pm UTC](https://www.ruby-forum.com/t/how-to-determine-if-you-are-in-a-partial/92284 "2007-04-17T20:31:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [April 17, 2007, 8:31pm UTC](https://www.ruby-forum.com/t/how-to-determine-if-you-are-in-a-partial/92284/1 "2007-04-17T20:31:53Z")

</div>

How do I determine if a helper is being called in a partial?

I need to do this to modify core helpers to act differently in partials.

Thanks!

---

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [April 17, 2007, 10:04pm UTC](https://www.ruby-forum.com/t/how-to-determine-if-you-are-in-a-partial/92284/2 "2007-04-17T22:04:01Z")

</div>

Ben J. wrote:

> How do I determine if a helper is being called in a partial?
> 
> I need to do this to modify core helpers to act differently in partials.
> 
> Thanks!

well, a _REALLY_ basic way could be:  
!(caller.to\_s =~ /render\_partial/).nil?

there’s probably a better way though
