Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Multiple check box with has many
<%= form_for(@user) do |f| %>
<div class="user_container">
<%= f.label :intrests %>
<ul>
<% Interest.all.each do |interest| %>
<li>
<label class="li">
<%= check_box_tag :intrest_ids, intrest.id, @user.interests.include?(interest), :name => 'user[intrest_ids][]' %> <u><%= intrest.title %></u>
</label>
</li>
<% end %>
</ul>
</div>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment