bernat / best_in_place

A RESTful unobtrusive jQuery Inplace-Editor and a helper as a Rails Gem
http://blog.bernatfarrero.com/in-place-editing-with-javascript-jquery-and-rails-3/
1.2k stars 574 forks source link

best_in_place in HABTM checkboxes #554

Open ghost opened 8 years ago

ghost commented 8 years ago

Following this tutorial https://www.youtube.com/watch?v=c2qwV0B9yfU from Ryan Bates. I implemented HABTM Checkboxes. The problem is that i can't get it working with best_in_place gem. I've tried 300 different ways and none work.

<div class="field">
    <%= hidden_field_tag 'order[category_ids][]', nil %>
    <% Category.all.each do |category| %>
           <%= check_box_tag 'order[category_ids][]', category.id, @order.category_ids.include?(category.id), id: dom_id(category) %>
            <%= label_tag dom_id(category), category.name %><br>
     <% end %>
  </div>

If you could help me turning this into best_in_place I would much appreciate it.