Try:

<%= f.text_field eval(":#{c}") %>

On Apr 13, 4:28 pm, ES <[email protected]> wrote:
> I have an array of the attributes of an object that I would like to
> use to generate a form. For example, I'd like to say
>
>        <% fields_for :questions do |f|%>
>          <% for c in @attributes %>
>              <%= f.text_field [c] %>
>
> how can I use an element of the array in place of [c] ?  I normally
> would put ":attributename"

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to