# Using text\_area helper in a partial

**URL:** <https://www.ruby-forum.com/t/using-text-area-helper-in-a-partial/163009>\
**Category:** Rails\
**Created:** [March 16, 2009, 3:40pm UTC](https://www.ruby-forum.com/t/using-text-area-helper-in-a-partial/163009 "2009-03-16T15:40:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jak4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19adc/32.png) [@jak4](https://www.ruby-forum.com/u/jak4)\
**Post date:** [March 16, 2009, 3:40pm UTC](https://www.ruby-forum.com/t/using-text-area-helper-in-a-partial/163009/1 "2009-03-16T15:40:37Z")

</div>

Hi,

if someone could tell how to work around this.

I’m calling a partial like so:  
render :partial =\> ‘space\_line’, :locals =\> {:external\_space =\>  
@new\_space.external\_space, :space =\> @new\_space}

Within the partial I have the following text\_area code:  
text\_area( :external\_space, :space\_comment, :style =\> “width:  
100%”, :class =\> “rich\_text\_editor”)

I assumed the text\_area helper would access the local  
variable :external\_space, but of course does not. Instead it looks for  
@external\_space. If it doesn’t find one, it creates an empty text  
area.

Can I somehow provide a local variable, or am I out of luck here?

Best regards  
jak4

---

<div class="post-metadata">

**Author:** ![jak4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19adc/32.png) [@jak4](https://www.ruby-forum.com/u/jak4)\
**Post date:** [March 16, 2009, 3:41pm UTC](https://www.ruby-forum.com/t/using-text-area-helper-in-a-partial/163009/2 "2009-03-16T15:41:48Z")

</div>

On Mar 16, 1:45 pm, jak4 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I assumed the text\_area helper would access the local  
> variable :external\_space, but of course does not. Instead it looks for  
> @external\_space. If it doesn’t find one, it creates an empty text  
> area.
> 
> Can I somehow provide a local variable, or am I out of luck here?

either assign the local variable to an instance variable (yuck) or use  
form for which allows you to bind fields to non-instance variables.

Fred

---

<div class="post-metadata">

**Author:** ![jak4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19adc/32.png) [@jak4](https://www.ruby-forum.com/u/jak4)\
**Post date:** [March 17, 2009, 11:29am UTC](https://www.ruby-forum.com/t/using-text-area-helper-in-a-partial/163009/3 "2009-03-17T11:29:18Z")

</div>

i am guessing fred wants you to use form\_for 🙂

On Mar 16, 3:40 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![jak4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19adc/32.png) [@jak4](https://www.ruby-forum.com/u/jak4)\
**Post date:** [March 18, 2009, 3:50pm UTC](https://www.ruby-forum.com/t/using-text-area-helper-in-a-partial/163009/4 "2009-03-18T15:50:42Z")

</div>

I think you are right ;). But since form\_for didn’t work I went with  
the yuck part and hope that nobody will ever find out.
