/ Published in: Rails
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<p>Companies:<br/> <table class="tbl"> <% cells = 0 %> <% Company.find(:all).each do |c| %> <% cells += 1 %> <% if cells.divmod(3)[1] == 1 -%><tr><% end -%> <td><input type="checkbox" name="technology[company_ids][]" value="<%= c.id -%>" <% if @technology.companies.include?(c) -%> checked="checked" <% end -%> /> <%= c.name %></td> <% if cells.divmod(3)[1] == 0 -%></tr><% end -%> <% end %> </table> </p>