Skip to content

Instantly share code, notes, and snippets.

@jgautsch
Created March 12, 2013 16:18
Show Gist options
  • Save jgautsch/5144281 to your computer and use it in GitHub Desktop.
Save jgautsch/5144281 to your computer and use it in GitHub Desktop.
Submitting an extra null element
Couldn't find all Roles with IDs (5, ) (found 1 results, but was looking for 2)
<div id="role-options-<%= user.id %>" class="modal" style="display: none;">
<%= simple_form_for user, :url => user_path(user), :html => {:method => :put, :class => 'form-horizontal' } do |f| %>
<div class="modal-header">
<a class="close" data-dismiss="modal">&#215;</a>
<h3>Change Role Test</h3>
</div>
<div class="modal-body">
<%= f.input :role_ids, :collection => Role.all, :as => :check_boxes, :label_method => lambda {|t| t.name.titleize}, :label => false, :item_wrapper_class => 'vertical', checked: user.role_ids %>
</div>
<div class="modal-footer">
<%= f.submit "Change Role", :class => "btn" %>
<a class="btn" data-dismiss="modal" href="#">Close</a>
</div>
<% end %>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment