Helper in other helper

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs