# Helper in other helper

**URL:** <https://www.ruby-forum.com/t/helper-in-other-helper/112987>\
**Category:** Rails\
**Created:** [August 25, 2007, 2:34pm UTC](https://www.ruby-forum.com/t/helper-in-other-helper/112987 "2007-08-25T14:34:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![memex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5e9695/32.png) [@memex](https://www.ruby-forum.com/u/memex)\
**Post date:** [August 25, 2007, 2:34pm UTC](https://www.ruby-forum.com/t/helper-in-other-helper/112987/1 "2007-08-25T14:34:23Z")

</div>

Hello everyone,

in my view, I wrap a form\_for around a model:

\<% form\_for(:  
[…]  
) do |f| %\>

Now I repeat the following very often why I would like to extract it  
into a helper:

\<%= f.text\_field :field\_1, :class=\>“css\_class”%\>  
xxx

Therefore, I packed it into a helper. Unfortunately, it does not get  
interpreted as Code but html text:

def textfield\_helper(input1, input2)  
returnarray=[]  
returnarray \<\< f.text\_field :#{input1}, :class=\>“css\_class”  
returnarray \<\< “\<span class=“css\_class2”\>”  
returnarray \<\< xxx  
returnarray \<\< “”  
end

Any ideas how to rephrase this: returnarray \<\<  
f.text\_field :#{input1}, :class=\>“css\_class” line?  
Everything else seems to be ok!  
Thank you very much in advance,

memex
