Can I use an array with fields_for?

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
work:

<% for r in @rs %>
<% fields_for r do |f| %>
   Employee: <%= f.select (: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 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