Skip to content

Instantly share code, notes, and snippets.

@surendrans
Last active August 29, 2015 14:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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