I''m making a musicians site where the users are able to check some checkboxes with their music-style if they want to edit their music-style i would like the previous checked checkboxes to be checked. here''s some code <div class="form_row"> <label for="looking_for"><%= label %>:</label> <table> <tr> <% @i = 0 %> <% @status = false%> <% collection.each do |db_field| %> <% db_collection.split(", ").each do |collection_field| %> <% if db_field == collection_field %> <% @status = true %> <% else %> <% @status = false%> <% end %> <% end %> <td> <%= check_box_tag array, db_field, @status %> <%= db_field %> </td> <% if @i == 1 %> <% @i = -1 %> </tr><tr> <% end %> <% @i = @i +1 %> <% end %> </tr> </table> </div> collection could be: VALID_STYLES = ["Blues", "Country", "Elektronisk", "Folkemusik", "Hip-Hop", "Jazz", "Klassisk", "Metal", "Pop", "R&B og Soul", "Rock", "Verdensmusik"] and the db_collection could be: Blues, Elektronisk, R&B og Soul I don''t know why, but with the code i have now R&B og Soul would get updated in the view so that the checkbox would be checked, it''s always the last option that gets checked. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---