# Problems with passing :locals to a partial

**URL:** <https://www.ruby-forum.com/t/problems-with-passing-locals-to-a-partial/136406>\
**Category:** Rails\
**Created:** [May 1, 2008, 7:13pm UTC](https://www.ruby-forum.com/t/problems-with-passing-locals-to-a-partial/136406 "2008-05-01T19:13:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 1, 2008, 7:13pm UTC](https://www.ruby-forum.com/t/problems-with-passing-locals-to-a-partial/136406/1 "2008-05-01T19:13:34Z")

</div>

I have:

\<% @link\_categories.each do |lc| %\>  
…  
\<%= link\_to\_function (image\_tag “icons/bullet\_add\_green.png”, :align  
=\> “absmiddle”, :border =\> 0),  
“show category” do |page|  
page[:subcategory].toggle  
page[:subcategory].replace\_html  
:partial =\> “new\_subcategory”,  
:locals =\> {:data =\> lc.data, :pid =\> lc.id }  
end  
%\>  
…

In the partial I have:

…

Neue Unterkategorie in **“\<%= data %\>”** erstellen:  
…  
\<%= hidden\_field “link\_category”, “member\_id”, :value =\> “2” %\>  
\<%= hidden\_field “link\_category”, “parent\_id”, :value =\> pid %\>

“data” is properly insert into the partial, but “pid” won’t.

Any hints?

Thanx

–  
Jochen

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 1, 2008, 10:26pm UTC](https://www.ruby-forum.com/t/problems-with-passing-locals-to-a-partial/136406/2 "2008-05-01T22:26:11Z")

</div>

double check lc.id is working, try another var name [?]
