<%= u.collection_select( :member_status_id, @member_statuses, :id, :name , { }, { :class => "select", :name => "member_status_id" })%>
I would try this. the first hash set is for options, the second is for HTML options. It looks like your passing args in the wrong place On Jan 13, 1:10 pm, wardenik <radek.anton...@gmail.com> wrote: > Hi, > > I have the following code: > <% @users.each do |u| -%> > <tr class="<%= cycle("odd", "even") %>"> > <td><%= u.name %>,<%= u.member_status_id %></td> > <td><%= collection_select( u, :member_status_id, > @member_statuses, :id, :name , { :class => "select"}, { :name => > "member_status_id" } ) %> </td> > </tr> > <% end %> > > The select is generating fine, apart from the fact that appropriate > options are not selected. > > <%= u.member_status_id %> is returning correct values for the records > (1,2,3,4) > MemberStatus.all.inspect returns: > > [#<MemberStatus id: 1, name_pl: "Obserwator", name_en: "Observer", > created_at: "2011-01-10 15:02:58", updated_at: "2011-01-10 15:02:58", > created_by: nil, updated_by: nil>, #<MemberStatus id: 2, name_pl: > "Baby", name_en: "Baby Member", created_at: "2011-01-10 15:02:58", > updated_at: "2011-01-10 15:02:58", created_by: nil, updated_by: nil>, > #<MemberStatus id: 3, name_pl: "Pełne", name_en: "Full Member", > created_at: "2011-01-10 15:02:58", updated_at: "2011-01-10 15:02:58", > created_by: nil, updated_by: nil>, #<MemberStatus id: 4, name_pl: > "Alumn", name_en: "Alumni", created_at: "2011-01-10 15:02:58", > updated_at: "2011-01-10 15:02:58", created_by: nil, updated_by: nil>, > #<MemberStatus id: 5, name_pl: "Zrezygnowa\305\202", name_en: > "Resigned", created_at: "2011-01-10 15:02:58", updated_at: "2011-01-10 > 15:02:58", created_by: nil, updated_by: nil>, #<MemberStatus id: 6, > name_pl: "Inactive", name_en: "Inactive", created_at: "2011-01-10 > 15:02:58", updated_at: "2011-01-10 15:02:58", created_by: nil, > updated_by: nil>] > > But still, the helper is not putting the "selected" where it should. > Any advice? -- 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.