# Can partial\_2 called by partail\_1 access partial\_1's locals?

**URL:** <https://www.ruby-forum.com/t/can-partial-2-called-by-partail-1-access-partial-1s-locals/104413>\
**Category:** Rails\
**Created:** [May 17, 2007, 6:19pm UTC](https://www.ruby-forum.com/t/can-partial-2-called-by-partail-1-access-partial-1s-locals/104413 "2007-05-17T18:19:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stepheneb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@stepheneb](https://www.ruby-forum.com/u/stepheneb)\
**Post date:** [May 17, 2007, 6:19pm UTC](https://www.ruby-forum.com/t/can-partial-2-called-by-partail-1-access-partial-1s-locals/104413/1 "2007-05-17T18:19:07Z")

</div>

I have partial\_2 that renders some links. It is sometimes called  
directly with a :locals hash.

I also have partial\_1 that renders the top and bottom of some pages  
and it is also called with a :locals hash.

I’d like to be able to render partial\_2 within partial\_1.

This is how partial\_1 is called:

\<%= render(:partial =\> ‘partial\_1’, :locals =\> {  
:authorable\_object =\> @external\_otrunk\_activity,  
:authorable\_object\_class =\> ExternalOtrunkActivity,  
:all\_viewable\_objects =\> @all\_viewable\_external\_otrunk\_activities,  
:all\_editable\_objects =\> @all\_editable\_external\_otrunk\_activities })  
%\>

And within partial\_1 I am trying to render partial\_2 and pass the  
locals that partial\_2 needs.

\<%= render(:partial =\> ‘partial\_2’, :locals =\> {  
:authorable\_object\_class =\> authorable\_object\_class,  
:all\_viewable\_objects =\> all\_viewable\_objects,  
:all\_editable\_objects =\> all\_editable\_objects }) %\>

But the locals for partial\_2 appear to be nil.

Is there a way to do this?

Thanks for any help.
