Skip to content

Instantly share code, notes, and snippets.

@surendrans
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save surendrans/5643a67a29a483ce0868 to your computer and use it in GitHub Desktop.
Save surendrans/5643a67a29a483ce0868 to your computer and use it in GitHub Desktop.
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