applitect icon

Access additional values in a Checkbox Collection

applitect | PRO | 05/25/18 11:24:22 PM UTC | 0 ⭐ | 3703 👁️ | Never ⏰ | []
Ruby |

400 B

|

None

|

0 👍

/

0 👎

# 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

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎