applitect

Access additional values in a Checkbox Collection

May 25th, 2018
5,335
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.40 KB | None | 0 0
  1. # In the example below I'm grabbing and printing the Parent ID value for a category inside a Check Box Collection field.
  2.  
  3. <%= f.collection_check_boxes :category_ids, list_artwork_categories_by_type(@artwork.artwork_type_id), :id, :name do |b| %>
  4.   <% p b.object.parent_id %>
  5.   <div class="collection-check-box form-check">
  6.     <%= b.check_box(class: "checkbox") %>
  7.     <%= b.label %>
  8.   </div>
  9. <% end %>
Advertisement