Forum: Ruby on Rails Can I use an array with fields_for ?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
0c51049fb747cd60088e4878458e05d1?d=identicon&s=25 Rick Schumeyer (Guest)
on 2007-02-15 17:26
(Received via mailing list)
Ok, I'll try one more time...I've read the book, I've searched the docs,
I can't find the answer this puzzle.
Surely someone can help!

@rs is an array, and I want to have a select field for each item in @rs.
How can I do this?  The following (which is inside a form_for) does not

    <% for r in @rs %>
    <% fields_for r do |f| %>
       Employee: <%= (:employee_id, ['alan', 'bob'] %><br/>
    <% end %>
    <% end %>

I get the error
'@#<AccountEmployeeRelation:0xb7628038>' is not allowed as an instance
(each item in @rs is an AccountEmployeeRelation)
This topic is locked and can not be replied to.