Try:
<%= f.text_field eval(":#{c}") %>
On Apr 13, 4:28 pm, ES <emsto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.