I am implementing in Ruby on Rails and I am trying to work with the collection_select, I m a newbie. I just want to do, I have a list with groups and a list with roles. These are both models. So, I list my groups, and next to that, I have a dropdown list with the role for the group. each group has 1 role. I implemented some code already, but the collection_select always only remembers the last item. So I want a list with groups, connected with the desired role. But, now I only have 1 item. This is my view:
<% @groups.each do |group| %>
<li>
<%= collection_select( group , role_id , @roles, id , name ) %>
</li>
<% end %>
我不知道现在要做什么? 有些人知道我做了什么错误?
增 编