Access additional values in a Checkbox Collection
# In the example below I'm grabbing and printing the Parent ID value for a category inside a Check Box Collection field. <%= f.collection_check_boxes :category_ids, list_artwork_categories_by_type(@artwork.artwork_type_id), :id, :name do |b| %> <% p b.object.parent_id %> <div class="collection-check-box form-check"> <%= b.check_box(class: "checkbox") %> <%= b.label %> </div> <% end %>
Comments
0 B
|👍
/👎